...
Register the url Scheme accordingly, we have prepared different url Schemes for our clients (please check this with our Customer Support Team).
In order to register your URL Scheme into your iOS PanelApp, you need to edit the Info.plist file under the "Supporting Files" in your project folder, two ways:
you can edit it in any editor, if you do so, please insert the following code:
Code Block <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>***</string> //please change *** to your URL name, not so important <key>CFBundleURLSchemes</key> <array> <string>***</string> //very important, please replace *** with the url Scheme assigned for your company, please contact us for such info if you didn't receive. </array> </dict> </array>
Or you can edit this in xcode, add an item into Info.plist, named "URL types", expand "Item 0" under "URL types", and add two items: "URL identifier", "URL Schemes". For "URL identifier",
assign your identifier, and for "URL Schemes", add a new item within it named "Item0",
REGISTER THE A UNIQUE URL SCHEME ASSIGNED FOR YOUR COMPANY (please contact us for such info if you didn't receive)APP, VERY IMPORTANT!It should be like the following:
Implement
application:openURL:sourceApplication:annotation:
method in your PanelAppIf your PanelApp is requested by a custom URL,
application:openURL:sourceApplication:annotation:
method is invoked in the application delegate. If this method is not implemented,
then the deprecatedapplication:handleOpenURL:
method is called. In your PanelApp, you have to implement application:openURL:sourceApplication:annotation:
method for further operation.In PanelApp application delegate, the application:openURL:sourceApplication:annotation: method should be implemented similarly as the example below:
Code Block - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { // call the handleURL:url method, and return yes if request handled correctly.(You can implement in your style) return [(ViewController *)application.keyWindow.rootViewController handleURL:url]; }
After implement the application:openURL:sourceApplication:annotation: method, the last step should be the implementation of a method which handles the detailed operation
(In our example, the method is [handleURL:url]).Implement handleURL() method, and import our Spring/SpringStreams library into PanelApp:
Code Block - (BOOL)handleURL:(NSURL *)url { NSLog(@"handleURL: %@", url); // initialize our spring/springstreams lib(if you have imported springstreams lib, the code is almost the same, just initialize a springstreams object), you can do this here, or somewhere before this call Spring *spring = [[Spring alloc] initWithSiteAndApplication:@"test" application:@"iOS Test App"]; //spring lib configurations, recommended configuration for testing purpose spring.tracking = YES; spring.debug = YES; spring.offlineMode = NO; // Please insert the following code snippet, it will read the valuable info from the request, VERY IMPORTANT NSMutableDictionary *dict = nil; dict = [[NSMutableDictionary alloc]init]; NSString *listString = [url absoluteString]; NSArray *listItems = [listString componentsSeparatedByString:@"&"]; for (NSString *temp in listItems) { if ([temp rangeOfString:@"="].location!=NSNotFound) { NSLog(@"--------------------%@",temp); [dict setObject:[[temp componentsSeparatedByString:@"="] objectAtIndex:1] forKey:[[temp componentsSeparatedByString:@"="] objectAtIndex:0]]; } } //most important of all, commit the parameters to backend box [spring commit:dict]; return YES; }