1

iOS Gurus,

I'm creating an iOS application that will respond to Custom URLs. When reading the documentation for handling a custom URL (API doc here: application:openURL:sourceApplication:annotation:), I see that the 4th argument is an annotation, defined as follows:

annotation
A property-list object supplied by the source application to communicate information to the receiving application.

However, when I look at the method for opening custom URLs (API doc here: openURL:), there is no way to define a "property-list" object. You can only specify the URL (which itself may have name/value parameters in the query string).

How can I pass a "property-list" object in addition to the URL to an application?

John Fowler
  • 3,173
  • 3
  • 18
  • 31

2 Answers2

1

The annotation option is for apps that are opened when a user references a document created by that app using a UIDocumentInteractionController.

If you're looking to launch the app from a custom URL scheme in a UIWebView then this does not pertain to you.

Richard Brown
  • 11,346
  • 4
  • 32
  • 43
0

To complete the first part of the answer by @Richard, set the annotation property of the UIDocumentInteractionController with a valid property list prior to calling presentPreviewAnimated:

NSURL *fURL = [[NSBundle mainBundle] URLForResource:@"Document" withExtension:@"pdf"];
if (fURL) 
{
    UIDocumentInteractionController *dIC;
    dIC = [UIDocumentInteractionController interactionControllerWithURL: fURL];
    dIC.annotation = @{@"foo": @"bar"};
    [dIC setDelegate:self];
    [dIC presentPreviewAnimated:YES];
}
Chuck H
  • 7,434
  • 4
  • 31
  • 34