iOS iPhone iPad Simulator - objective-c

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"]

Related

GCGamepad Deprecated?

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

CSIndexErrorDomain error -1005

I am getting this error "The operation couldn’t be completed. (CSIndexErrorDomain error -1005.)" while running code for spotlight search on ipad.Does anyone know how to solve this error?
The CoreSpotlight is available on iOS 9 onwards.
Though your device maybe at iOS 9.x, it still may not work if it is a older device version.
From Apple docs.
Although app search is available for iOS 9 users, the search functionality of NSUserActivity and Core Spotlight is not supported on iPhone 4s, iPad 2, iPad (3rd generation), iPad mini, and iPod touch (5th generation)."
So if you are testing on any of the above devices or simulators for the same you will get the CSIndexErrorDomain error -1005.
From Corespotlight API documentation
CSIndexErrorCodeIndexingUnsupported = -1005, //Indexing isn't
supported on this device
Since the Search feature is not available on all the devices supporting iOS9 so check the following condition to know whether the device supports search
if ([CSSearchableIndex isIndexingAvailable])
and keep the methods of search under this condition.

Why has Xcode 6.1 killed [NSLocale preferredLanguages] in IOS 8 simulators

Yesterday Xcode updated to v6.1.
Now, [NSLocale preferredLanguages] is returning an empty array in the iPhone, but only for IOS 8 - both in iPhone 5 and 6 emulators. IOS 7 simulators are still working fine.
A physical iPhone 6 device doesn't appear to be affected - it's just the simulators.
The usual attempts - clean project, restart Xcode, reboot Mac - have made no difference. So, what's the best strategy - wait for Xcode 6.1.1, or send a complaint to an Apple list (which one) ?
You can use category with currentLocale method swizzling as described in here. The category allows one to override in general language and region settings in the project for all targets at once.
Also you can use scheme settings for each target in separate way.
If you have many localizations in your app,
you can change Application language and Application region in scheme settings for each target. You can even make a separate target for each localization for faster language tests.
Product -> Scheme -> Edit scheme...
I've flagged this for consideration as a dupe. Global preferences aren't working in the iOS 8.1 simulator. Localization is one such global preference. See:
See iOS8.1 Simulator always uses US keyboard layout despite german hardware keyboard
As for "strategy" ... you could just note that it's a known issue documented in the release notes and wait for a fix, or you can file a radar at http://bugreport.apple.com
First, they're simulators and not emulators. Second, I'm not seeing an empty array returned for [NSLocale preferredLanguages] under Xcode 6.1 (6A1052c) and any iOS 8.1 simulator, but I do always see "en" returned regardless of the language selected in the system settings. I do see correct behavior for any iOS 7 simulator, as you note.
I would file a bug complaint if one hasn't already been filed: more info at Changing language on iOS 8.1 simulator does not work.
Setting Product -> Scheme -> Preferences... didn't helped me, so I made a simple workaround:
NSString *language = [[NSLocale preferredLanguages] count] > 0 ?
[[NSLocale preferredLanguages] objectAtIndex:0] :
#"en";

pjsua_conf_disconnect do not mute mic on some Mac

The question:
Is it possible that under specific condition (hardware, ...) the pjsua_conf_disconnect(0, callInfo.conf_slot) function do not mute the mic?
If yes, how can we effectively mute the mic with PJSIP?
The details:
In a OSX SIP application, user can mute the mic, and this will call:
...
pjsua_call_info callInfo;
pjsua_call_get_info([self identifier], &callInfo);
pj_status_t status = pjsua_conf_disconnect(0, callInfo.conf_slot);
...
Where [self identifier] is the pjsua_call_id of the current call.
I know for sure that after those 3 lines, status == PJ_SUCCESS, because only if this condition is true the UI is updated to let the user know the mic is muted.
This project uses the pjlib 1.12.0 for POSIX static libs.
Users that face this problem are on Mac OSX 10.8.1 and 10.8.2. They are all using their built-in MacBook [Pro,Air] mic, no headset.
Note that I am NOT able reproduce this problem myself on an OSX 10.8.2 mid-2009 MBP with the exact same build (from the MacAppStore), this is what making this problem hard to trouble shoot.
Note that it is not a random problem, it is contant: as the mute function never works for users experiencing this issue, and it always work for the others.

How to let my application support iOS 4?

I tested my application on 8GB iPod Touch using iOS 4.0(within multitask), it works. But when I change my original source code, and built it in the simulator. The application load, but nothing appear, it all dark. What I should do to solve the problem? I check the console, it didn't show any error msg. Thank u.
In the Simulator, check the Hardware->Device and Hardware->Version settings. Also, try setting a breakpoint in your code and stepping through it to see how far it gets.