iOS PanelApp development

PanelApp Development Handbook

Why PanelApp?

Since the changes of Apple Development Policy, some of our clients can not grab advertisement id as their identifier anymore, instead we retrieve ifv (identifier_for_Vendor).

However ifv is unique for each single vendor, but not globally.

So for identifying each iOS device owned by the end user, we have to implement a PanelApp to pair with Main Application (any application which has imported spring/SpringStreams libs for measuring purpose).
PanelApp will forward the ifv from main application along with some other parameters to backend box, so that we can id each single device.

 

Implementation:

Generally for spring measuring purpose, only 3 modifications need to be applied in your PanelApp (This blog may assist your implementation):

  1. 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:

    1. you can edit it in any editor, if you do so, please insert the following code:

      	<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>
    2. 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 A UNIQUE URL SCHEME FOR YOUR APP, VERY IMPORTANT!

      It should be like the following:

       



  2. Implement application:openURL:sourceApplication:annotation: method in your PanelApp

    If 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 deprecated 
    application: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:

     

    - (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]). 

     

  3. Implement handleURL() method, and import our Spring/SpringStreams library into PanelApp:

    - (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;
    }