There is a problem with Swift Error type check on iOS16 beta.

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.

  1. iOS16 Beta
  2. Add 'SafariServices.framework' to Xcode project
  3. 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.

I've tested your findings above and this does look like an issue of a potential String: Error {} extension conformance. The most we can do is wait and see where the Beta revisions take us with the implementation SFError.

I can also verify this issue exists, and is breaking every one of my applications since I use promises with type String multiple places.

I have a same problem. please fix this issue.

Hello folks. We appreciate your feedback in the Developer Forums. To ensure the issue you're seeing can be investigated by the relevant engineering teams, please submit feedback reports for any issues you encounter. You can do so from the Feedback Assistant app or Feedback Assistant website.

A detailed bug report with logs allows the engineering teams to investigate the issue, and contact you via Feedback Assistant if they need more details or when the issue is resolved.

You can add your Feedback number (FBXXXX) to this thread for tracking purposes.

—Jason.


For many issues, a sysdiagnose and system report is can be very helpful, even if you think one's not necessary (it's gathered by Feedback Assistant app by default; you'll need to create a sysdiagnose and system profile yourself if you use the website), and any other logs that may be useful for investigating your report.

For code-related issues, a focused Xcode project that builds and reproduces the issue is also very helpful. It should include the minimal code and API necessary to reproduce the issue. (and may require you to perform additional debugging to extract the relevant code).

There is a problem with Swift Error type check on iOS16 beta.
 
 
Q