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.
I've developed an iOS app that uses the url(forPublishingUbiquitousItemAt:expiration:) method of Apple's FileManager class. Starting with the first Beta of iOS 13 this function stopped working and now it throws an error, stating "This code has been removed. You should switch off of this SPI". But I can't find anything related to this function neither in the release notes of iOS nor in the documentation for this function, and it even states there that it would be supported on Mac Catalyst 13.0+.
This also has nothing to do with Xcode 10 and 11, as it occurs when the app is built using either one of those versions.
Does anyone of you know more about that? It would be great to get new information on that.
Thanks,
Fabian.
This is fixed in iOS 13 beta 6. Updated today and this error magically disappeared!
Had my mind blown when I saw this error message.
Today, likely as a result of upgrading to iOS 12.3 on my test phone, I am now receiving the following notifications in my debug console when I first instantiate my MPVolumeView.
019-05-21 11:00:22.874353-0600 sports-audio-dj[3831:982163]
[MediaRemote] OutputDeviceUID is nil Speaker: (null)
I receive about 10+ of these.
Here is the code that kicks it off:
let volumeView = MPVolumeView(frame: self.view.bounds)
My code hasn't changed and I'd not seen this before today and wondering if anyone knows what is bringing this about and if I need to do anything about it if something is now unhappy. My app seems to work fine despite these new notifications.
Apple responded today with the following:
You can safely ignore this debugging message. It will be removed in a future version of iOS.
iOS 13 has finally removed these errant debug messages.
According to Apple's documentaion, I should be able to launch an app based on its bundle ID using the code below.
// Open safariapp
let safariApp = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")
// Launch safari app
safariApp.launch()
Unfortunately, this code will not compile because Xcode claims that XCUIApplication can not take any initialization arguments. This is my error:
Argument passed to call that takes no arguments
This functionality is available starting with the Xcode 9 SDK, so you'll need to update your Xcode version and migrate to Swift 3.2 or 4.
Source: https://developer.apple.com/documentation/xctest/xcuiapplication/2879415-init
After migration to new swift 3we've got a lot of automatic syntax changes among which:
DispatchQueue.main.async(execute: {
// Do something
})
documentation says that it's available in iOS 10 and later.
So I expected to see unrecognized selector error when running on iOS 8 but it still works.
So I'm just wondering if it would affect some users since our deployment target is iOS 8?
I just tested it on an iPod touch running 8.4 and DispatchQueue.main.async{} works just fine.
The docs are misleading (wrong?)
I went to log a documentation problem, but wait, among lots of other stuff that's been removed from the Xcodebuilt-in documentation system, you can't log issues with the docs anymore!
I suggest filing a radar bug, then.