-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-7240] [4.1 Regression] iOS deep link with UIApplicationDelegate.application(_:open:sourceApplication:annotation:)
implemented crashes older iOS versions
#49788
Comments
Thanks, DJ! @swift-ci create |
It looks like there's an SDK annotation problem here to begin with—the method's being invoked with a nil |
Comment by DJ Mitchell (JIRA) Happy to help 👍 thanks for taking a look so quickly! |
The API docs note that that method is deprecated. If you only need to target back to iOS 9.0, then as a workaround until we fix this bug, you might try implementing the replacement API instead, which doesn't appear to have this problem: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application |
It looks like you can also work around the problem by defining your implementation of the delegate method with the correct optionality, even if the SDK has the wrong nullability: // note that `annotation` has type `Any?`
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any?) -> Bool {
return true
} |
Comment by DJ Mitchell (JIRA) @jckarter did you verify that the method with the modified signature is actually getting called when the deep link is triggered? I know that if I just don't implement that method then the crash also goes away so it's possible that by changing the func definition it's just not getting called. Either way your first fix will work wonderfully, we only support >= 10.0 and we just haven't had a reason to upgrade to the new method. Thanks again for the quick turnaround and all of the work y'all do! |
Yeah, I checked by putting a breakpoint in the method implementation that it was still called after changing the annotation argument type to `Any?`. |
This should fix the problem in the master branch: #15465 |
and the 4.1 branch: #15467 |
Merged to both branches, so this should hopefully be fixed in future snapshots. |
Comment by DJ Mitchell (JIRA) Thanks for the help and the quick turnaround @jckarter! |
I'm seeing this with Version 9.3 (9E145), on device and simulator. Stack trace is similar: (lldb) po Thread.callStackSymbols ▿ 27 elements
|
The fix did not make it into Xcode 9.3. :-( |
Found the workaround. I feel you. |
Comment by DJ Mitchell (JIRA) angel (JIRA User) in the older comments Joe pointed out a couple of different solutions to this specific issue. If it's a different manifestation of the same compiler bug (which it looks like might be the case with SR-7355?) then you might have to find another way 'round it. |
angel (JIRA User) I described a workaround in https://bugs.swift.org/browse/SR-7240?focusedCommentId=33771&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-33771 . This workaround should also be in the Xcode 9.3 release notes. |
Comment by Mohamad (JIRA) [4.1 Regression] iOS deep link with `UIApplicationDelegate.application(_:open:sourceApplication:annotation🙂` implemented crashes older iOS versions |
Yes, this shipped in Xcode 9.4. |
Environment
Swift 4.1 Snapshot 2018-03-19 (a) (or Xcode 9.3 beta 4 Swift version)
iOS 10.3.1 (simulator or device)
Additional Detail from JIRA
md5: b84ebb317dbc0ecbabae355d825affbf
is duplicated by:
Formatter
Issue Description:
Deep linking using a custom URL scheme into any iOS app built with a recent Swift 4.1 toolchain causes the app to crash.
https://github.com/Killectro/SwiftCrashTest
Steps:
Open the above project in Xcode 9.2
Download any recent Swift 4.1 development toolchain or the one that shipped with Xcode 9.3 beta 4
Switch to 4.1 toolchain
On an iOS 10 device (tested with 10.3.1), run application and minimize it
Open Safari and type in `testing1234://` to deep link into the app
Observe crash
Switch back to Xcode 9.2 Swift toolchain
Attempt to repro again
Observe no crash
This crash only occurs if you implemented the {code:none}UIApplicationDelegate.application(_:open:sourceApplication:annotation🙂
The text was updated successfully, but these errors were encountered: