Software Development

Yesterday, I was working on Transloader v3.0. In particular, on its push notifications and making sure everything syncs properly.
Today, I wanted to continue working on this, but found myself unable to. My Mac suddenly didn’t receive CloudKit push notifications anymore.
Even worse, neither of the delegate methods

- (void)application:(NSApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

and

- (void)application:(NSApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

weren’t called anymore – without any code changes. Something was wrong.

But here we are, a couple of hours later, and everything’s working again. Finally.
So, to save you some time should this happen to you, here’s what I did:

Restart

I restarted my Mac – the obvious solution. You might think. Only that it didn’t work, the problem persisted. But it’s still the first thing I’ll try if this returns.

Delete Containers, Group Containers, and CloudKit Caches

In Finder, delete

/Users/yourname/Library/Containers/yourAppContainerFolder/
/Users/yourname/Library/Group Containers/yourGroupID.yourAppGroupContainerFolder/
/Users/yourname/Library/Caches/CloudKit/yourAppID
/Users/yourname/Library/Caches/CloudKit/CloudKitMetadata* (*all files that begin with that filename)
/Users/yourname/Library/Caches/CloudKit/CloudKitOperationInfo* (*all files that begin with that filename)

Now launch Activity Monitor.app and force quit the following processes:

cfprefsd
apsd
notifyd
remoted

Now, I’m not sure you need to force-quit each and every one of those, but I wanted to relaunch any process that remotely looked like it had to do with remote/push notifications.

At this point, I restarted Transloader through Xcode, and lo and behold, it worked again.
On my MacBook Pro, where the same problem occurred simultaneously, I took the same steps. And it *didn’t* work. A restart was required, so your mileage – like mine – may vary.

Additional Info

There’s also this handy technical note from Apple, which can help debugging push notifications on both macOS and iOS.

Read more

For Transloader’s upcoming version 3.0, I needed an NSMenuItem that not only showed a title, but also a subtitle, along with an optional image.

Because it took a bit of work and “reverse-engineering” (the click-on-an-item-selection-animation’s timing, in particular), I figured someone else might benefit from this.

Where to get it / Sample Project

It’s all pretty straight forward, and best shown / explained as an Xcode project, which you can download on Github.
This is basically all you need to do:

Screenshot the sample project's source code

That’s it!

Caveats

There are some things this implementation can not do, which the default NSMenuItem can:

  • There is no type select
  • The arrow keys can’t be used to go through the items
  • You can’t activate items with the space or enter keys

Basically, keyboard interaction is unavailable.

I do hope it’s useful to you anyways.
If you’re using this, I’d love to hear from you! 😊

Read more

 

Yoink for iPad and iPhone Usage Tip #7

The following explains how to use Yoink on iPad in Slide-Over or Split View.
For more Usage Tips like this, click here.


It seems quite a few people have been getting new iPads recently – to those, I say: congratulations on your purchase 🥳
Coincidentally, that’s probably why I’ve been asked quite frequently lately how to use Yoink in Slide-Over or Split View.
Here’s a quick guide on how to do it.

1) Use Yoink in Slide-Over

– With a full screen app open, swipe up from the very bottom of your iPad to reveal the Dock
– Drag Yoink from the Dock to the side of your iPad’s screen

In Slide-Over, you can reposition Yoink to either edge of your iPad’s screen, or dismiss it by dragging it all the way to the right.

2) Use Yoink in Split View

– With a full screen app open, swipe up from the very bottom of your iPad to reveal the Dock
– Drag Yoink from the Dock to the top right of your iPad’s screen
Alternatively, If Yoink is already in Slide-Over, drag the its top horizontal indicator to the top right of your iPad’s screen, and it will enter Split View.

In Split View, you can adjust the size of each Split view app by dragging the indicator between them.
You can remove an app from Split view by dragging the top horizontal indicator of the app.

Further Reading

Apple’s iPad User Guide
Use Multitasking on your iPad
Open an app in Slide Over

 

Read more