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 = value as? Error {
reject(error)
} else {
fulfill(Promise<Value>.asAnyObject(value))
}
The cause of incorrect operation was recognized as 'Error' even though the value 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 number2. 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 {}
I wonder if this kind of code actually exists in the framework, and I wonder if this is intended. If so, this code is syntactically acceptable, but since it can affect the operation of the application a lot, I think that it should not be added in the core library such as 'SafariServices.framework'.
If possible, I hope to fix it in the next iOS version.