如何在单击按钮时打开 instagram 应用程序
how to open instagram app on button click
大家好,我正在尝试通过单击按钮打开 instagram 应用程序,但我没有
我也可以在 plist 中将 Url 方案设置为 instagram
NSString *instagramURL = @"instagram://app";
NSURL *ourURL = [NSURLURLWithString: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 = @"//Some other Url goes here";
[[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];
我确实喜欢这个,但是应用程序打不开是 iOS 的新手任何帮助都可以
赞赏
您可以通过用户名打开 instagram 应用,例如,
NSURL *instagramURL = [NSURL URLWithString:@"instagram://user?username=USERNAME"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
关于api!!!
的更多方法和详情,您可以参考iPhone Hooks of Instagram
更新:
替换下一行,
NSString *instagramURL = @"instagram://app";
和
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
您正在将字符串直接分配为 url!!
在 Info.plist 文件中添加键值
<key>LSApplicationQueriesSchemes</key>
<array>
<string>instagram</string>
<string>twitter</string>
</array>
大家好,我正在尝试通过单击按钮打开 instagram 应用程序,但我没有 我也可以在 plist 中将 Url 方案设置为 instagram
NSString *instagramURL = @"instagram://app"; NSURL *ourURL = [NSURLURLWithString: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 = @"//Some other Url goes here"; [[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];
我确实喜欢这个,但是应用程序打不开是 iOS 的新手任何帮助都可以 赞赏
您可以通过用户名打开 instagram 应用,例如,
NSURL *instagramURL = [NSURL URLWithString:@"instagram://user?username=USERNAME"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
关于api!!!
的更多方法和详情,您可以参考iPhone Hooks of Instagram更新:
替换下一行,
NSString *instagramURL = @"instagram://app";
和
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
您正在将字符串直接分配为 url!!
在 Info.plist 文件中添加键值
<key>LSApplicationQueriesSchemes</key>
<array>
<string>instagram</string>
<string>twitter</string>
</array>