Hello Guys am trying to open instagram app on button click but not able to open
here s what i did
NSString *instagramURL = @"instagram://app";
NSURL *ourURL = [NSURL URLWithString:instagramURL];
if ([[UIApplication sharedApplication]canOpenURL:ourURL])
{
[[UIApplication sharedApplication]openURL:ourURL];
} else {
//The App is not installed. It must be installed from iTunes code.
NSString *iTunesLink = @"//Your itunes Url";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"URL error"
message:[NSString stringWithFormat:
@"No custom URL defined for %@", ourURL]
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
and i set urlschema in plist as instagram
where am doing wrong and i did write any line in app delegate
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
return YES;
}
and i registered app in instagram also am new to ios any help would be appriciated