GCGamepad Deprecated? - objective-c

While testing one of our old iPad game (written in Objective-C), we found that GCGamepad is now deprecated. What is the replacement right now?
The game can still run perfectly on iOS 13 including gamepad support, but we would like to "modernise" it.
It surprise us that we can simply convert this game to Mac via Mac Catalyst! Everything works (including keyboard commands) except for gamepad.

I think you're meant to use GCExtendedGamepad now. https://developer.apple.com/documentation/gamecontroller/gcextendedgamepad?language=objc

Related

Migrate app to ios11 for Iphone X

I need to update my app and make it look good on the iphone X. I've seen a couple of answers on stackoverflow and on the internet regarding the new safe area option (Use Safe Area Layout Guides).
According to what I've read the app should adapt automatically using autolayout as well but what I've got is this:
If I start a new project it all works fine. The project is quite big, so starting all over again is not an option. What should I do?
Thanks
I just had the same problem, and in my case, the problem was that my app didn't have a Launch Screen.storyboard, it was using a image as launcher. So adding a new Launch Screen.storyboard and selecting that one fixed it, maybe the rest of the app takes some settings from that Launch Screen.storyboard

iOS iPhone iPad Simulator

This is what I get when I test my iPhone code on iPadPro 12.9 inch 2nd generation simulator. Isn't there a discrepancy ? Thanks, David.
I would highly recommend using this UIDeviceHardware instead of checking the interface idiom:
https://github.com/fahrulazmi/UIDeviceHardware/blob/master/UIDeviceHardware.m
NSString *platformString = [UIDeviceHardware platformString];
I've been using it for awhile now, and it works perfectly for me.
However, there is a problem when using it on simulator. When running on simulator, the platform is equal to x86_64 or i386 which will simply return iPad or iPhone. So ... I feel like you won't find a satisfying conclusion unless you tested this on a real device or at least got someone to test it for you on a real device.
In your case, you would check for one of these two platform strings:
"iPad Pro 12.9-inch (WiFi)" or "iPad Pro 12.9-inch (Cellular)"
https://github.com/fahrulazmi/UIDeviceHardware/blob/master/UIDeviceHardware.m#L83-L84
A good way to check for those is to just check for the prefix:
[platforString hasPrefix:"iPad Pro 12.9-inch"]

NSStatusItem reordering along Status Bar

I am trying to add a functionality to my status bar app for Mac OS X. I would like to be able to move my item along the bar, as you can do for the native OS tools like the Bluetooth or the WiFi icon.
Cheers
Update for macOS Sierra: Apple improved NSStatusItem. Items can now be reordered by ⌘-dragging. This works for all Apple’s menu items and all third party apps.
Pretty much all the reasons you could ever want to use NSMenuExtra have been removed now, which is great. So, the answer now is to just use NSStatusItem. No further action is required.
What you are looking for is NSMenuExtra and not NSMenuItem.
Apple uses NSMenuExtra for the system menu icons including Wi-Fi and Bluetooth. Although it looks similar to the regular NSMenuItem, NSMenuExtra has some special features, notably to keep their relative order after rebooting, and Command-Draggable by user.
Unfortunately, NSMenuExtra is totally undocumented, so if you are targeting the Mac App Store, it's better for you to stick with the standard NSMenuItem. Otherwise, there is a bunch of tutorials about how to create an NSMenuExtra. For example, here are two of them:
NSMenuExtra – working with undocumented APIs
Building NSMenuExtra - A Small Tutorial
Unfortunately there is no 'good' way to do that, however you can check this question for the hack which can do that:
How to drag NSStatusItems

Custom icon for each NSUserNotification?

Is there any way to provide custom icons for each NSUserNotification, instead of the default app logo? Like the iconData parameter in Growl.
I want to show "Someone has just posted something" with the photo of this "someone".
You still cannot change the (default) image showing your app's icon, but starting in OS X Mavericks you can in addition display an additional image using the new property contentImage, e.g. like this:
This new property isn't documented in the NSUserNotification class reference, but mentioned in the Foundation Release Notes for OS X 10.9.
Currently not (Mountain Lion). You should post a feature request.
I know this question has been dead for 5 years, but in case someone finds that question and is still looking for a solution, there is that one:
https://github.com/indragiek/NSUserNotificationPrivate
I've tested it in macOS Sierra and it still works. Just be warned, quoting the project creator:
This should go without saying, but using any of this will result in
your app being rejected from the MAS (Mac Apple Store) and potentially breaking if the
APIs change.
Looking for a related answer about NSUserNotifications I found your question. Officially it's not yet supported. But I wrote a little custom control you can use that may fit your needs. Take a look on this Github repository.

Showing multiple simultaneous tool tips in Cocoa

I want to add a feature to my Mac app inspired by the Help mode in iPhoto for iPad, pictured below. I would love to do this using built-in APIs, so I don't have to build my own tool-tip-like view. Is there any way for me to either show multiple tool tips at the same time, or to achieve something similar using NSHelpManager?
If you are targeting 10.7 or later you could do this fairly easily using NSPopover. You would have to create quite a few popover windows but it isn't difficult to do.