ios - 通过我的应用程序打开 Instagram 应用程序

标签 ios objective-c

我试图从我的应用程序中打开 instagram 应用程序并实现了以下代码,但它没有执行任何操作。我在我的 iPhone 上安装了 Instagram 应用。

NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
   [[UIApplication sharedApplication] openURL:instagramURL];
}

最佳答案

为 key LSApplicationQueriesSchemes更新info.plist

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>instagram</string>
    </array>

代码:

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
    [[UIApplication sharedApplication] openURL:instagramURL];
}

引用instagram docs

关于ios - 通过我的应用程序打开 Instagram 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44730601/

相关文章:

ios - 在 Sprite 工具包中将文本写成一个圆圈(swift)

ios - 如何计算 MKMapView 的缩放级别以适合 MKCircle?

ios - CGContextClipToMask 不剪辑

ios - Swift – UITabBar.appearance().barTintColor 在模拟器中不起作用

ios - 在 map 底部显示 View

ios - SceneKit ios 中的立方体的所有侧面都没有发光

ios - 即使应用程序未运行,如何拥有一个可用的地理围栏?

IOS 仅在发布时崩溃

ios - 退出时保存当前状态,重新打开应用程序时自动重新加载

ios - XCode 8 在加载索引时在启动时保持卡住