I’m working on an iOS app that uses a custom URL scheme, and the registration of the scheme is working. The user returns to the app when a URL referencing the scheme is opened.
Now I’m trying to get access to the URL that was used to open the app and any parameters that were passed. To do that, I’m using a custom class for the app itself and implementing the “application:openURL:sourceApplication:annotation:” method.
The “open” event handler of the application class includes this code (to add the method):
if ( not class_addMethod(appDelegateClass, _
AddressOf implOpenURL, "v@:@:@") ) then break
The class appears to be added successfully - the debugger doesn’t break here. However, the “openURL” event never fires.
The implementation (“implOpenURL”) looks like this:
Its parameters are defined as:
pid as ptr, openURL as NSURL, sourceApplication as NSString, annotation as NSObject
I suspect that the problem has to do with how I’m defining the params - and specifically how the “annotation” is being defined. According to Apple’s docs for the method (which are available here), the annotation is a “property list object.” I’ve tried defining it as an NSObject, NSArray, etc, without any luck. I’m not exactly sure what the “property list object” really is.
Has anyone else has run into similar issues with “openURL” or successfully implemented it?
Thanks in advance for any help.