My project and 3rd-party library have the following code, but it is working incorrectly on iOS16, so I tried debugging it.
if let error = result as? Error {
reject(error)
} else {
fulfill(Promise<Value>.asAnyObject(result))
}
The cause of incorrect operation was recognized as 'Error' even though the result type was 'String'.
The reproduction conditions are as follows.
- iOS16 Beta
- Add 'SafariServices.framework' to Xcode project
- Xcode version does not matter (13.4, 14.0 beta all occur)
The key here is number 3. If you create a sample project and add only 'SafariServices.framework' to the project, the result of the code below is true.
let stringValue: String = "abc"
print(stringValue is Error)
So I'm guessing that the following code is in 'SafariServices.framework' of iOS16Beta.
extension String: Error {}
So, I wonder if this extension was added and if this was intended.
I think this code is syntactically acceptable, but it should not be added in the core library such as 'SafariServices.framework' because it can affect the operation of the application a lot.
If possible, I hope to fix it in the next iOS version.