iOS 9 not opening Instagram app with URL SCHEME

后端 未结 14 1908
攒了一身酷
攒了一身酷 2020-11-22 06:33

The following URL opens on iOS 8.3 and lower, but it does not work and iOS 9

let instagramURL = NSURL(string: \"instagram://app\")

Why won\

14条回答
  •  悲哀的现实
    2020-11-22 07:10

    Assuming two apps TestA and TestB. TestB wants to query if TestA is installed. "TestA" defines the following URL scheme in its info.plist file:

    CFBundleURLTypes
    
        
            CFBundleURLSchemes
            
                testA
            
        
    
    

    The second app "TestB" tries to find out if "TestA" is installed by calling:

    [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"TestA://"]];
    

    But this will normally return NO in iOS9 because "TestA" needs to be added to the LSApplicationQueriesSchemes entry in TestB's info.plist file. This is done by adding the following code to TestB's info.plist file:

    LSApplicationQueriesSchemes
    
        TestA
    
    

    A working implementation can be found here: https://github.com/gatzsche/LSApplicationQueriesSchemes-Working-Example

提交回复
热议问题