जवाबों:
जब आप iOS 9 के लिए अपना ऐप बनाते हैं तो आप URL योजनाओं का उपयोग करना जारी रख सकते हैं और आप URL योजनाओं को कॉल करना चाहते हैं, अब आपको उन्हें अपने ऐप्स Info.plist में घोषित करना होगा। एक नई कुंजी है, LSApplicationQueriesSchemes , और यहां आपको उन योजनाओं की सूची को जोड़ना होगा, जिन पर आप करना चाहते हैं।
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
</array>
यदि आप iOS9 का उपयोग कर रहे हैं तो यह आपकी info.plist फ़ाइल को अपडेट करने के लिए महत्वपूर्ण है। आपको बस 3 चरण करने की आवश्यकता है। 1 पर जाएं। info.plist 2. एक फ़ील्ड जोड़ें जिसका नाम है LSApplicationQueriesSchemes NSArray datatype। 3. NSString डेटाटाइप के एक आइटम को fbauth2 के रूप में जोड़ें।
फेसबुक एसडीके के v4.6.0 के रूप में, अपनी फाइल में निम्न कुंजी जोड़ें:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
notबताता है कि, यह अच्छा है कि आपने इसे इंगित किया है!
बस फेसबुक स्पष्टीकरण का पालन करें: iOS9 के लिए आपके ऐप्स तैयार करना
Apple ने उनका उल्लेख किया है: गोपनीयता और आपका ऐप कीनोट 2015
कृपया इसे केवल अपने CFBundleURLSchemes में न जोड़ें ... जो वास्तव में फेसबुक ऐप पर किसी भी ऐप के प्रयास को HIJACK करेगा, जिससे "X ऐप ओपन करना चाहता है" डायलॉग दिखाने के लिए एक पॉपअप हो सकता है ...
आप ऐसा नहीं करना चाहते।
सीएफ:
https://developers.facebook.com/docs/applinks/ios
https://www.fireeye.com/blog/threat-research/2015/04/url_masques_on_apps.html
https://www.reddit.com/r/workflow/comments/2tlx29/get_url_scheme_of_any_app
मेरा कीवी परीक्षण चलाते समय मुझे यह मिला क्योंकि हमारे परीक्षण लक्ष्य के पास मुख्य बंडल तक पहुंच नहीं थी। इसलिए मैं में एक शर्त जोड़ें पड़ा isRegisteredCanOpenURLSchemeमेंFBSDKInternalUtility.m
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme
{
static dispatch_once_t fetchBundleOnce;
static NSArray *schemes = nil;
dispatch_once(&fetchBundleOnce, ^{
schemes = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"LSApplicationQueriesSchemes"];
if (!schemes) { // This is a work around for our Kiwi tests as the Specs target doesn't have access to main bundle
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"Info" ofType:@"plist"];
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:path];
schemes = [dictionary valueForKey:@"LSApplicationQueriesSchemes"];
}
});
return [schemes containsObject:urlScheme];
}
IOS 9 के लिए अपना ऐप बनाने के लिए: (फेसबुक शेयर के लिए)
Info.plistफ़ाइल खोलें , सूचना गुण सूची के अंतर्गत एक और फ़ील्ड LSApplicationQueriesSchemes जोड़ें और इसे डेटाटाइप या सेट करें ।ArrayNSArrayStringNSStringfbauth2, fbshareextension, fbapiआइटम मूल्य के रूप में।इस तस्वीर का पालन करें :
Write the below code in your info.plist under the **LSApplicationQueriesScheme**
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
आप नीचे दिए गए कोड के साथ कोशिश कर सकते हैं swift 5.0
extension Bundle {
static let externalURLSchemes: [String] = {
guard let urlTypes = main.infoDictionary?["LSApplicationQueriesSchemes"]
as? [String] else {
return []
}
return urlTypes
}()
}
आप का उपयोग कर कॉल कर सकते हैं Bundle
guard Bundle.externalURLSchemes.contains(URLScheme) else {
return
}