iOS 14 getAllVoiceShortcuts returning LaunchServices errors - ios14

In a completely blank Xcode project, I simply call:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
INVoiceShortcutCenter.shared.getAllVoiceShortcuts { (shortcuts, error) in
}
}
}
It fails with this log:
[default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=271, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
This is retried 20 times until it gives up.
Siri Capability was added to the App. Happens only on physical device in iOS 14 GM and Xcode 12 GM.
Any help would be much appreciated.

I have same problem (as you said, only in physical device), but I have 10 retries, not 20.
Before iOS 14.0 I had no errors, so maybe it is some bug in SiriKit.
I noticed that this is happens only once - when you call this next time, there are no errors.
So, for now, I added this call in AppDelegate - when app is starting, because that errors freeze UI for a second.

Related

SKStoreProductViewController crashes for unrecognized selector named sceneDisconnected: in iOS 15.6 beta5

In iOS 15.6 beta5 and iOS 16.0 beta:
When an UISceneDidDisconnectNotification was posted, any active SKStoreProductViewController instance would crash for the unrecognized selector named sceneDisconnected.
-[SKStoreProductViewController sceneDisconnected:]: unrecognized selector sent to instance 0x115161a00
This crash only happened in the latest iOS15.6 and iOS16 beta version. Yet I can't find the selector name in any official documents……
Any solutions? Or Is there anything I haven't done right?
Looks like this was fixed in the iOS 15.6 release candidate that was realeased today.
Sept 14 2022 Update: Apple re-introduced this crash in the official 15.7 release. It only seems to happen when the app is force quit so it should not affect users. I've filed a ticket to Apple on feedbackassistant.apple.com and would encourage others to do the same.
Not a solution, but a clear indication that this is Apple's bug to fix. Starting with a clean sample project, all you need to do is present a SKStoreProductViewController and then force quit your application:
import StoreKit
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let storeKitViewController = SKStoreProductViewController()
storeKitViewController.loadProduct(withParameters: [
SKStoreProductParameterITunesItemIdentifier: NSNumber(integerLiteral: 364709193)
])
present(storeKitViewController, animated: true)
// Force quit after presentation to trigger crash
// -[SKStoreProductViewController sceneDisconnected:]: unrecognized selector sent to instance
}
}
I've filed this with Apple via Feedback Assistant.
The crash has been fixed in iOS16
below is an explanation by Apple Framework Engineer
This crash happens in the public release of iOS/iPadOS 15.7, and seed releases of iOS/iPadOS 16 prior to seed 4 [1]. It does not occur in the public release of iOS 16.
The crash primarily happens when the app is in the background and is about to be terminated by the operating system. As a result, these crashes are not expected to be visible to the majority of end users. (One exception is on iPad with an app that supports multiple scenes, and a user manually terminates a scene.)
Your analytics will show an increased in crash rate, however your customers should not be affected by this issue.
We are actively working to address the crash.
[1] In which case you should update to the most recent release.
source: https://developer.apple.com/forums/thread/714464?answerId=729646022#729646022
Able to reproduce a crash with the same stack symbols locally and the code below stops the crash from occurring. The code is creating empty functions to handle the unrecognized selector message and restricting this extension to iOS 15.7:
#available(iOS, introduced: 15.7, obsoleted: 16.0)
#objc extension SKStoreProductViewController {
func sceneDisconnected(_ arg: AnyObject) {}
func appWillTerminate() {}
}
Add this code in application(_:didFinishLaunchingWithOptions:) (at least before the app is terminated). It adds the methods at runtime if they don’t exist.
if #available(iOS 15.7, *) {
if #unavailable(iOS 16.0) {
class_addMethod(
SKStoreProductViewController.self,
Selector(("appWillTerminate")),
unsafeBitCast({ _, _ in } as #convention(c) (SKStoreProductViewController, Selector) -> Void, to: IMP.self),
"v#:"
)
class_addMethod(
SKStoreProductViewController.self,
Selector(("sceneDisconnected:")),
unsafeBitCast({ _, _, _ in } as #convention(c) (SKStoreProductViewController, Selector, NSNotification) -> Void, to: IMP.self),
"v#:#"
)
}
}
It seems they removed appWillTerminate and sceneDisconnected(_:) methods in iOS 15.7, but forgot to remove the code that adds UIApplication.willTerminateNotification and UIScene.didDisconnectNotification observers to the NotificationCenter.
Edit: They seem to have re-added appWillTerminate and sceneDisconnected(_:) methods in iOS 15.7.1. So I’ve updated the code to add the methods only in iOS 15.7.
Edit: They removed the methods AGAIN in iOS 15.7.2 and the crash recurred. I’ve reverted the code.
This is actually an inaccurate reporting because it doesn't actually cause the crash.
I reproduced the reported scene: click on the app-download advertisement in your app, pop up the in-app App Store download page, and then back to the background, the crash message is generated in this time -- but no crash actually occurred, and nothing changed when I returned to the foreground. Everything works fine. The next time the app starts, the crash information will be reported.
So no need to do anything now, just wait for Apple to fix it.
Since version 15.7.1 has been released, we see a decrease in crashes in Firebase Crashlytics. Also when filtering the crashes on iOS version, version 15.7.1 is not present in the list.
This seems a good indication that Apple has finally resolved this issue in 15.7.1.
Please share your observations from your own crash reports to verify that my assumption is correct.

NEHotspotConfigurationManager keeps returning Internal Error on iOS 11

I am trying to get my mobile app to connect to a Wifi network (for configuration purposes). This should be possible as of iOS 11 through the NEHotspotConfiguration & NEHotspotConfigurationManager classes.
The problem is that I keep getting an Internal Error (error code 8) and I don’t get a user prompt to ask for permission to connect to wifi network. I have already set the Hotspot Configuration capability in Xcode that the NEHotspotConfigurationManager class requires. Also worth mentioning that I am testing this on a real device only, since the iOS simulator does not support wifi.
Although I am using the NativeScript framework, it seems that this is more of an issue with the underlying iOS platform.
So far I have this code:
this.wifiManager = NEHotspotConfigurationManager.new();
this.wifiConfig = NEHotspotConfiguration.alloc().initWithSSID(this.config.wifi.SSID);
this.wifiConfig.joinOnce = true;
this.wifiManager.applyConfigurationCompletionHandler(this.wifiConfig, (error: NSError) => {
if (error && error.code!==NEHotspotConfigurationError.AlreadyAssociated) {
console.log(`wifiManager.applyConfigurationCompletionHandler error code ${error.code}: ${error.localizedDescription}`);
} else {
console.log(`wifiManager.applyConfigurationCompletionHandler success!`);
}
});
Thanks in advance!
P.S. this post suggest that it might just be an issue on the device itself and that a device restart should solve the issue but that is not the case for me
I just tried your code and it worked exactly like this. I got internal error code 8 too, then I enabled the hotspot configuration capability and deployed to my iOS 11 device. It immediately showed the required dialog.
Here's my complete code:
constructor() {
let configManager = NEHotspotConfigurationManager.new();
let config = NEHotspotConfiguration.alloc().initWithSSID('Guest');
config.joinOnce = true;
configManager.applyConfigurationCompletionHandler(config, (error: NSError) => {
if (error && error.code !== NEHotspotConfigurationError.AlreadyAssociated) {
console.log(`wifiManager.applyConfigurationCompletionHandler error code ${error.code}: ${error.localizedDescription}`);
} else {
console.log(`wifiManager.applyConfigurationCompletionHandler success!`);
}
});
}
In case somebody stumbles upon this question in the future
TL;DR
Bug in iOS - Hopefully fixed in 12.2 - restart iPhone on older iOS versions
We had this problem too although we set the correct capability. The internal error was thrown until we restarted the phone. Until today we have not understood when or how this broken state was reached.
Luckily there was a discussion in the Apple Developer forums where #eskimo answered:
eskimo Nov 27, 2018 12:59 PM:
Folks keep tripping over this so I thought I’d post an update. As
others have noted above we have a bug to track this issue (r.
42919071). Right now I can’t offer any predictions as to when this
will be fixed. Moreover, I don’t have any solid workaround
suggestions.
I should stress that the symptoms of this bug persist until the device is restarted. If you encounter this error transiently — that is, you get the error and then, later on, things work without having to restart the device
It also looks like this bug was fixed in iOS 12.2
~eskimo Feb 21, 2019 9:24 AM:
If you’ve hit this problem in the past I’d appreciate you retesting on
the latest iOS 12.2 beta seed. We’ve made some changes there to fix
this issue, and it’d be nice to know if they’re working as expected.
Source: https://forums.developer.apple.com/thread/107851

Xcode 9 iOS Simulator - Unable To Obtain Valid Process Handle

I have upgraded to Xcode 9, and the iOS Simulator for 10.3 and 11 are not working. All stock and my apps are force closing when trying to run.
Xcode Console errors like the following show when I try to run Calendar, Preferences etc. What does the "Unable to obtain valid process handle" mean?
Process handle (com.apple.Preferences, <BSProcessHandle: 0x7fe84552b8b0; Preferences:9270; valid: NO>) is invalid. Returning error {
BKSProcessExitReason = 0;
BKSProcessJobLabel = "UIKitApplication:com.apple.Preferences[0x90bf][6825]";
NSLocalizedFailureReason = "Unable to obtain valid process handle";
}
[com.apple.Preferences] Bootstrap failed with error: <NSError: 0x600000846c60; domain: BKSProcessErrorDomain; code: 1 (bootstrap-failed); reason: "Unable to obtain valid process handle">
Bootstrapping failed for <FBApplicationProcess: 0x7ffae944f990; com.apple.Preferences; pid: -1> with error: Error Domain=BKSProcessErrorDomain Code=1 "Unable to bootstrap process with bundleID com.apple.Preferences" UserInfo={NSLocalizedFailureReason=Unable to obtain valid process handle, BKSProcessExitReason=0, BSErrorCodeDescription=bootstrap-failed, BKSProcessJobLabel=UIKitApplication:com.apple.Preferences[0x90bf][6825], NSLocalizedDescription=Unable to bootstrap process with bundleID com.apple.Preferences}
Process handle (com.apple.mobilecal, <BSProcessHandle: 0x7fe845525860; MobileCal:9363; valid: NO>) is invalid. Returning error {
BKSProcessExitReason = 0;
BKSProcessJobLabel = "UIKitApplication:com.apple.mobilecal[0xf53][6825]";
NSLocalizedFailureReason = "Unable to obtain valid process handle";
}
[com.apple.mobilecal] Bootstrap failed with error: <NSError: 0x604000643ae0; domain: BKSProcessErrorDomain; code: 1 (bootstrap-failed); reason: "Unable to obtain valid process handle">
Bootstrapping failed for <FBApplicationProcess: 0x7ffaeb141220; com.apple.mobilecal; pid: -1> with error: Error Domain=BKSProcessErrorDomain Code=1 "Unable to bootstrap process with bundleID com.apple.mobilecal" UserInfo={NSLocalizedFailureReason=Unable to obtain valid process handle, BKSProcessExitReason=0, BSErrorCodeDescription=bootstrap-failed, BKSProcessJobLabel=UIKitApplication:com.apple.mobilecal[0xf53][6825], NSLocalizedDescription=Unable to bootstrap process with bundleID com.apple.mobilecal}
Unable to find framework using path: /System/Library/Frameworks/VideoSubscriberAccount.framework
I've tried it on iPhone X, iPhone 8/8+ and iPhone 6+ simulators with iOS 11 / 10.3.1, all with the same crashing result. If I try it on older iOS simulators such as iPhone 6+ iOS 9.2, then it runs fine.
If I try to launch it many times, i.e. 40 - 50 times for Safari or Calendar, sometimes that specific app may run, and once successfully ran, it'll remain so for the rest of the session (until I close the app at the task switcher, then same problem recurs). The same happens for my Xcode compiled app too.
My iMac 2009 has been running El Capitan and Xcode 8 fine all the while, and I just upgraded to High Sierra with Xcode 9.
I tried Xcode 9.1 Beta, but same problems persisted.
Please help, thanks.
Thanks to #russbishop's suggestion of disabling 3rd party kernel extensions, I have found the culprit — One Periodic's Hands Off Firewall!
I unloaded the kext with this command:
kextunload -b com.metakine.handsoff.driver
And immediately all the stock apps in iOS Simulator can start perfectly fine. Note that you must unload the kext. Simply disabling the rules in Hands Off does not fix the problem.
However, I cannot "kextload" back the Hands Off driver once I am done to reactivate the firewall. A system reboot is needed.
I have reported this issue to Hands Off as well, and hopefully see a fix in the next release.
Thanks #JeremyHuddlestonSequoia for helping with the diagnosis too.

iOS 9 - Keyboard displays bundle name as "(null)" on upgrade

I have an iOS keyboard app extension which exists in the app store. Recently, while testing the effects of upgrading the app from version 1.0 to 1.1, I noticed that when I press and hold the globe icon on the standard iOS keyboard, my app's name is displayed as (null). Has anyone else experienced this? This tends to happen if I do not try to open the companion app before opening the keyboard after upgrade. If I open the companion app, this tends to go away. I've attached an image below.
Update:
Using iOS Console, I noted the log entry below:
Oct 5 16:16:40 Sarangan-Balasubramaniams-iPad SpringBoard[48] <Warning>: Installed apps did change.
Added: {(
)}
Removed: {(
)}
Modified: {(
"com.vijay.SuperKeyz"
)}
Oct 5 16:16:41 Sarangan-Balasubramaniams-iPad pkd[116] <Warning>: INSTALLED:com.vijay.SuperKeyz.keykeykeyboard com.vijay.SuperKeyz.keykeykeyboard(1.1) <__NSConcreteUUID 0x17d93870> AF3C211B-0871-49F1-89EF-433510FE85C4 /private/var/mobile/Containers/Bundle/Application/24643C20-B44F-47A4-ADB5-57EA10FF9CF0/SuperKeyz.app/PlugIns/keykeykeyboard.appex
Oct 5 16:16:46 Sarangan-Balasubramaniams-iPad pkd[116] <Warning>: assigning plug-in com.vijay.SuperKeyz.keykeykeyboard(1.0) to keyboard sandbox
Oct 5 16:16:46 Sarangan-Balasubramaniams-iPad pkd[116] <Warning>: enabling pid=1662 for plug-in com.vijay.SuperKeyz.keykeykeyboard(1.0) 4DAC067D-4E00-48A0-86CB-7519AC750C8A /private/var/mobile/Containers/Bundle/Application/8CA610CD-672B-40ED-A564-08EB2D90FD11/SuperKeyz.app/PlugIns/keykeykeyboard.appex
Oct 5 16:16:46 Sarangan-Balasubramaniams-iPad MobileSMS[1662] <Warning>: Communications error: <OS_xpc_dictionary: <dictionary: 0x158928a0> { count = 2, contents =
"errorcode" => <uint64: 0x158b7ae0>: 4
"error" => <string: 0x1588ca30> { length = 114, contents = "cannot obtain executable path for plug-in com.vijay.SuperKeyz.keykeykeyboard(4DAC067D-4E00-48A0-86CB-7519AC750C8A)" }
}>
I apologize for the hard-to-read output, but what you can see is that iOS is searching for my plugin at the wrong path. It's looking for my old install path, instead of the new one. My simple guess is that the iOS keyboard is caching the list of other keyboards someplace, and doesn't update it until some other trigger.
I've seen this too; this is a bug in iOS. You should file a radar on it.
Generally you can fix the issue for an individual App by closing the app from the app switcher and reopening it.
Spotlight and Quick Reply, in my experience, won't let the keyboard come up until the device has been restarted, which also fixes the issue for all other Apps.
For people still facing this in iOS 10+, make sure your Bundle Name is the same as your Bundle Display Name.

Watch os 2.0 Beta: Not Receiving notifications

I know it's not possible to ...:
... schedule notifications straight from the Watch, instead the watch has to deliver information to the iOS app, which will schedule it;
... decide where to show the notification. iOS Decides it for you instead;
With this in mind, I'm using the WCSession::sendMessage function to send a dictionary with all the info my iOS app needs to schedule a nofitication. When doing this with the simulator it works nicely, but when doing it on a real device it doesn't seem to work and I never receive a notification anywhere.
Any idea why my real devices (iOS9 iPhone 5c + Watch os 2.0 Beta 5) don't seem to want to schedule/trigger notifications?
As far as I understood it, it should show the notification on the watch if the iphone is locked, but on my simulator it seems to always do it on the iPhone, even though it is locked.
Edit:
After a suggestion, I checked out the device backlog via XCode and this is what I see appearing in that backlog when the watch tries to connect to the iPhone:
Aug 21 11:25:16 glendcs-iPhone apsd[100] <Notice>: (Note ) WatchKit: SPDeviceConnection, createXPCConnection, invalidationHandler
Aug 21 11:25:16 glendcs-iPhone apsd[100] <Notice>: (Error) WatchKit: -[SPDeviceConnection activeComplicationsWithCompletion:] - error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.companionappd was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.companionappd was invalidated from this process.}
Aug 21 11:25:16 glendcs-iPhone companionappd[113] <Notice>: (Error) WatchKit: <SPCompanionAppServer.m -[SPCompanionAppServer listener:shouldAcceptNewConnection:]:763> process 100 is not entitled, so rejecting connection
I solved it myself. Apperently the problem was the beta versions of iOS9 and Watch OS 2 not matching up anymore. I upgraded my iOS a while ago to Beta 5, but forgot to do WatchOS, as I'm not used to this process. After syncing beta versions up today, connection between iOS and WatchOS was smooth :)
And for the first time I could also properly debug from XCode on the watch!

Resources