New OutputDeviceUID is nil msg when instantiating MPVolumeView - ios

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.

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.

Requesting an In App Purchase in iOS 13 fails

I use SwiftyStoreKit to request In App Purchases and get only this error with iOS 13:
Error: Optional(Error Domain=ASDErrorDomain Code=507 "Error decoding object" UserInfo={NSLocalizedDescription=Error decoding object, NSLocalizedFailureReason=Attempted to decode store response})
I cannot request information about the products, nor make purchases with a sand box account. However, it works fine in iOS 12.1 on my device. It does not work with the iPhone 11 simulator or an actual device with iOS 13.
I have found a lot, that the Xcode 11 GM seed 1 beta simulator had this problem, but have not found a solution yet. I also tested it with the new released Xcode 11 GM seed 2 version, but there was no fix for me.
Does anyone have a solution on how I can request and purchase In App Purchases again with iOS 13 installed?
Restarting Xcode and simulator did the trick: now my in-app purchases load properly in iOS 13 simulator.
EDIT: This happens in release Xcode 11 too. And happens once in a while, but restarting Xcode and simulators still helps.
EDIT 2: In Xcode 12 beta this bug is also present. But the solution is to create new StoreKit Configuration file (in File -> New menu)
Then add all your products there. Use the same product id's as in AppStore Connect.
Then add this file to Run Scheme configuration.
I had the same issue, iOS13 Simulators produced the same error, iOS12 Simulators were working well.
I then tried out on the iPhone with iOS13 installed, there the calls were working flawlessly too.
Hoping that it'll be fixed soon in Xcode Simulators, I guess until then we are stuck with the error.
Edit:
Now it seems to work also in iOS 13 Simulator Devices.
Note: I've updated the answer, read the Edit part.
To share my experience, it seems that this problem does not exist any more in Xcode 11.1 GM Seed. There's no need to restart Simulators or Xcode to make in-app purchases work anymore.
I had submitted an app for review and it was rejected because of that particular error. As it turns out, it was rejected for a stupid reason as it wasn't my app's bug, however I spent hours trying to get around it.
So, just update to Xcode 11.1 GM Seed and run again. Everything will be okay.
EDIT
The issue still exists in Xcode 11.1 and apparently I was just lucky that it didn't happen to me again. However, I had a second rejection for the exact same reason. What eventually worked and made my app get approved was this:
I had to update my IAP record on App Store by editing and saving it again.
So, I recommend you to try the same; change something temporarily in your IAPs, save and then revert your changes (and save again) so records on the App Store to be refreshed.
FYI, after the second rejection Apple invalidated my IAP and therefore showed me the way. It looks like to be a known issue to them at the end.
For details read this discussion I wrote on Reddit.
For those that has this issue in iOS 14.0, you still need to create the storekit configuration file as per #silvansky answer. Rather than adding it to the target, we can actully start an SKTestSession before making any product request in order to avoid the error.
if #available(iOS 14.0, *) {
do {
let session = try SKTestSession(configurationFileNamed: "Your_StoreKit_Configuration_File_Name")
session.disableDialogs = true
} catch {
// catch error here
}
// Start your product request here
let productIdentifiers = Set(["product_identifier_1", "product_identifier_2"])
let productsRequest = SKProductsRequest(productIdentifiers: productIdentifiers)
productsRequest.delegate = self
// Run the request
productsRequest.start()
}
You can refer to Apple's documentation for SKTestSession for more info: https://developer.apple.com/documentation/storekittest/sktestsession

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.

UIFeedbackGenerator object creation crashes on iOS 10.0

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.

IOS report crash

I'm using crittercism to get the crash report from my ipad app.
What i need is to check if the app was crashed last time loaded at startup.
I'm using the CrittercismDelegate that contains crittercismDidCrashOnLastLoad on the appDelegate of my app but it seems does not work !!
any example/suggestions on this ?
this is Rob, one of the co-founders of Crittercism. That's a known bug that we're releasing a fix for early next week!
We will be adding some more info on our support page shortly:
https://www.crittercism.com/developers/feedback

Resources