Callback URL for iOS App

This page shows how to call Mocha LPR from your iOS code, and get license plate data back.

A simple iOS app example: lprtest.zip

Your iOS application must have an URL Schemes defined: Example

Start Mocha LPR with a call to function openURL with a parameter telling, where to return the license plate data.
- (IBAction) doit_action:(id)sender
{
    NSLog(@"doit");
    NSString *tmp2 = [NSString stringWithFormat:@"mochalpr://CALLBACK=lprtest://"];
    NSURL *url = [NSURL URLWithString:tmp2];
    
    if (![[UIApplication sharedApplication] openURL:url]) {
       NSLog(@"doit failed");
    }
}
			
To receive the license plate data back, in the Appdelegate.m file define:
- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary<NSString *,
                     id> *)options
{
    if (!url) {  return NO; }
    NSString *URLString = [url absoluteString];
    NSLog(@"Url return %@",URLString);
    if (URLString != nil) {
        NSString * start =@"lprtest://?PLATE=";
        if ([URLString hasPrefix:start] && [URLString length] > [start length]+1) {
            NSString *tt = [URLString substringFromIndex:[start length]];
            NSLog(@"result is %@",tt);
        }
    }
    return YES;
}