UIFeedbackGenerator object creation crashes on iOS 10.0 - ios

Has anyone else encountered this? Specifically with an iPhone 6 running iOS 10.0 I'm getting consistent reports of the following crashing:
if #available(iOS 10.0, *) {
UISelectionFeedbackGenerator()
}
Where it's not even being used, just created and it causes an EXC_BAD_ACCESS crash. The docs say it just fails silently if the device doesn't support it. Oddly enough if I change the check to iOS 10.0.1 it works fine.
Am I doing something wrong?

I saw a few seemingly random crashes in production when calling this function as well. When reviewing some old logs, I found that this was only occurring on iOS 10.0.0. As users updated past that, I stopped seeing the crash. I imagine it was some sort of internal UIKit bug that was fixed in iOS 10.0.1.

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.

Admob crashes in ios13 but works on ios14

So I have a number of apps that were working fine. Just recently I tried some of them out on an earlier iOS (13.5) in the simulator and they ALL crash when I load the advert (interstitial.load or banner.load). They were ALL working on earlier simulators previously (some of them are a few years old so iOS 14 didn't even exist).
The error is:
Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
I don't understand what this means but there is no other context so Ive been struggling to understand what the issue is. It always stops at the .load line.
I am using app tracking transparency but have tried removing it and still get the same behaviour.
Has anyone else experienced this??
I don't know if its on real devices or just the simulators...(I don't have a real device with an old iOS to test it on).
Ive a feeling it might be to do with all the new privacy stuff that's flying around.
Thanks for any help.

iOS 13 - FileManager url(forPublishingUbiquitousItemAt:expiration:) not working anymore

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.

New OutputDeviceUID is nil msg when instantiating MPVolumeView

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.

DispatchQueue.main.async availability iOS 10 works on prior iOS

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.

Resources