Bug in iOS 16 DevBeta1
mlch911 opened this issue · 13 comments
String can convert to NSError in iOS 16.
This most likely is a bug in iOS 16.
Hope Apple could fix this soon.
My app also worked strangely on iOS16, so I tried debugging it and the reason was the code above as well.
However, this problem is not only a problem with iOS 16, but potentially also on iOS 15 and lower versions.
Just add this code to your project and the problem will be reproduced regardless of iOS version.
extension String: Error {}
So I think that this problem is not only due to the Apple, but potentially to the Promises as well.
It is assumed that the problem occurred in iOS16 because the above code exists in 'SafariServices.framework' of iOS16.
I reported this issue to the Apple Developer forums.
https://developer.apple.com/forums/thread/708025
@ykjchen Can we get someone to look at this? It's a pretty massive issue that breaks a ton of use cases for Promises
Thanks for reporting. It looks like this results in success being handled like an error, in the case where the promise type is String.
Is that the correct read on this?
Yes that is correct.
Thanks for reporting. It looks like this results in success being handled like an error, in the case where the promise type is String.
Is that the correct read on this?
Yes that is correct.
However, currently there is only a problem with the String type in iOS16,
If it extends to Int: Error {}, etc., it may be a problem for other types as well.
For details, refer to the information submitted to the forums.
https://developer.apple.com/forums/thread/708025
Does changing the check from:
if let error = value as? NSError {
to something like:
if type(of: error) is NSError.Type
seem like a possible solution?
I believe that does work yes.
Edit: this does work, every place that attempts casts value to NSError should be replaced with a check of type instead
Is there anything else I need to do in order to get this merged? We are holding off on pushing the next build of our app until this has been resolved
Apologies for the delay, thanks for your patience, just added a review.
No worries, just got those changes in so hopefully all is done now
Sure, it's done now.