Tuesday, 17 November 2015

How to populate OTP from user's sms Inbox to application directly in ios/iphone

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)

 url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
if (!url) {
    UIApplication * yourapplication =[UIApplication sharedApplication];
    NSString *outputpath =@"appname://data/";
    NSURL *url =[NSURL URLWithString:outputpath];
    [yourapplication openURL:url];
    return NO;
}

NSUserDefaults *defaultString =[NSUserDefaults standardUserDefaults];
NSString * commonString =[url absoluteString];
if (commonString.length<=15) {
    //
}
else
{
    [defaultString setObject:commonString forKey:@"urlString"];
}
     //send info to the screen you need and can navigate
 return YES;
}