OpenURL app in Swift

I have a problem with the Appdelegate OpenURL method.

I set my imported UTI and document type. But when I open my application from the email application, the application immediately fires when I have an implemented method.

Canceled handleOpenURL works, but not OpenURL?

At the moment, I have no code in the implementation, and I'm just returning true.

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String, annotation: AnyObject?) -> Bool { return true } 

Failure says Thread 1: EXC_BAD_ACCESS (code-1, address-0x0)

I really don't want to use the deprecated method.

+5
source share
1 answer

This is pretty typical of a signature mismatch between the method signatures automatically generated by the Swift compiler and the actual signature. This happens when you try to pass nil from Objective-C to swift, explicitly deployed optionally. Change the annotation parameter to be implicitly expanded and you must be gtg.

+2
source

Source: https://habr.com/ru/post/1203930/


All Articles