2015-09-21 8 views
6

हम सिम्युलेटर में ऐप ट्रांसपोर्ट सुरक्षा त्रुटियां प्राप्त कर रहे थे (ओएसएक्स 10.10.5 पर चल रहे एक्सकोड 7)। हमने आईओएस 9 के लिए एफबी दिशानिर्देश लागू किए।एफबीएसडीके सुरक्षित नेटवर्क अनुरोध आईओएस 9

एफबी ग्राफ एपीआई का आह्वान किया गया था जो एसडीके v.3.24 पर आधारित था।

हमने ऐप info.plist फ़ाइल में आवश्यक ऐप ट्रांसपोर्ट सुरक्षा अपवाद डालने के बाद सफलतापूर्वक बिट के साथ संकलित फेसबुक एसडीके जोड़ा था।

त्रुटियां एटीएस info.plist कॉन्फ़िगरेशन, i की कमी में फेसबुक दस्तावेज़ों की तरह दिखाई देती हैं। ई .:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) 
2015-09-21 15:25:20.862 flirtop[41983:2110078] FBSDKLog: WARNING: FBSDK secure network request failed. Please verify you have configured your app for Application Transport Security compatibility described at https://developers.facebook.com/docs/ios/ios9 
2015-09-21 15:25:21.131 flirtop[41983:2110592] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) 
2015-09-21 15:25:21.132 flirtop[41983:2110078] FBSDKLog: WARNING: FBSDK secure network request failed. Please verify you have configured your app for Application Transport Security compatibility described at https://developers.facebook.com/docs/ios/ios9 
2015-09-21 15:25:21.135 flirtop[41983:2110078] Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, NSErrorPeerCertificateChainKey={type = immutable, count = 2, values = (
    0 : 
    1 : 
)}, NSUnderlyingError=0x7fec5d300b40 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=https://graph.facebook.com/v2.4, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, kCFStreamPropertySSLPeerCertificates={type = immutable, count = 2, values = (
    0 : 
    1 : 
)}, _kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFStreamErrorDomainKey=3, NSErrorFailingURLKey=https://graph.facebook.com/v2.4, _kCFStreamErrorCodeKey=-9802}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., --- SNIP --

हमारे plist, ऐप्लिकेशन आईडी से छोड़ा जाता है, निम्नलिखित

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>CFBundleDevelopmentRegion</key> 
    <string>en</string> 
    <key>CFBundleExecutable</key> 
    <string>$(EXECUTABLE_NAME)</string> 
    <key>CFBundleIdentifier</key> 
    <string>com.fwlab.$(PRODUCT_NAME:rfc1034identifier)</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>6.0</string> 
    <key>CFBundleName</key> 
    <string>$(PRODUCT_NAME)</string> 
    <key>CFBundlePackageType</key> 
    <string>BNDL</string> 
    <key>CFBundleShortVersionString</key> 
    <string>1.0</string> 
    <key>CFBundleSignature</key> 
    <string>????</string> 
    <key>CFBundleVersion</key> 
    <string>1</string> 
    <key>CFBundleURLTypes</key> 
    <array> 
     <dict> 
      <key>CFBundleURLSchemes</key> 
      <array> 
       <string>OMITTED</string> 
      </array> 
     </dict> 
    </array> 
    <key>FacebookAppID</key> 
    <string>OMITTED</string> 
    <key>FacebookDisplayName</key> 
    <string>Flirtop</string> 
    <key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSExceptionDomains</key> 
     <dict> 
      <key>graph.facebook.com</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
       <key>NSExceptionAllowsInsecureHTTPLoads</key> 
       <true/> 
      </dict> 
      <key>facebook.com</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
       <key>NSExceptionAllowsInsecureHTTPLoads</key> 
       <true/> 
      </dict> 
      <key>fbcdn.net</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
      </dict> 
      <key>akamaihd.net</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
      </dict> 
     </dict> 
    </dict> 
    <key>LSApplicationQueriesSchemes</key> 
    <array> 
     <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> 
    </array> 
</dict> 
</plist> 
+0

चूंकि आपके पास पहले से ही 'facebook.com' है और इसमें सबडोमेन शामिल हैं, क्या आपने यह देखने के लिए 'graph.facebook.com' को आसानी से निकालने का प्रयास किया है? – Rog

+0

हां, यह मुद्दा नहीं था। –

उत्तर

3

हल किया गया था। ऐप बंडल में कॉपी की गई info.plist सही नहीं थी। यह graph.facebook.com प्रविष्टि के बिना काम करता है, जो आवश्यक नहीं है।

यह स्पष्ट हो गया जब मैंने फेसबुक लॉगिन का उपयोग करने की कोशिश की और यह शिकायत की कि url fbauth2 info.plist फ़ाइल में मौजूद नहीं था।

संयोग से, Info.plist का सही अंतिम भाग निम्नलिखित है, जिसमें सही पूर्ण फेसबुक एसडीके सेटअप शामिल है। NSExceptionRequiresForwardSecrecy = FBse काम करने के लिए FB ग्राफ एपीआई के लिए पर्याप्त है।

चूंकि एफबी सर्वर मेरे नियंत्रण में नहीं हैं, शायद मुझे एनएसटीहर्डपार्टी अपवाद का उपयोग करना चाहिए, हालांकि निम्न सेटअप काम करता है।

-- SNIP -- 
<key>UIMainStoryboardFile</key> 
    <string>Main</string> 
    <key>UIRequiredDeviceCapabilities</key> 
    <array> 
     <string>armv7</string> 
    </array> 
    <key>UIStatusBarTintParameters</key> 
    <dict> 
     <key>UINavigationBar</key> 
     <dict> 
      <key>Style</key> 
      <string>UIBarStyleDefault</string> 
      <key>Translucent</key> 
      <false/> 
     </dict> 
    </dict> 
    <key>UISupportedInterfaceOrientations</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
     <string>UIInterfaceOrientationLandscapeLeft</string> 
     <string>UIInterfaceOrientationLandscapeRight</string> 
     <string>UIInterfaceOrientationPortraitUpsideDown</string> 
    </array> 
    <key>UISupportedInterfaceOrientations~ipad</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
     <string>UIInterfaceOrientationPortraitUpsideDown</string> 
     <string>UIInterfaceOrientationLandscapeLeft</string> 
     <string>UIInterfaceOrientationLandscapeRight</string> 
    </array> 
    <key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSExceptionDomains</key> 
     <dict> 
      <key>facebook.com</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
      </dict> 
      <key>fbcdn.net</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
      </dict> 
      <key>akamaihd.net</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionRequiresForwardSecrecy</key> 
       <false/> 
      </dict> 
     </dict> 
    </dict> 
    <key>LSApplicationQueriesSchemes</key> 
    <array> 
     <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> 
    </array> 
</dict> 
</plist> 
+0

मेरे पास plba फ़ाइल सहित fistuth फ़ाइल है; ऐप सही ढंग से लॉगिन और लॉगआउट; हालांकि मुझे अभी भी निम्न त्रुटि मिलती है: [4102: 149576] -canOpenURL: URL के लिए विफल: "fbauth2: /" - त्रुटि: "(शून्य)" 'कोई विचार क्यों? – oyalhi

+0

यह शायद एक पूरी तरह से असंबंधित समस्या है। मेरे मामले में मुझे एक त्रुटि मिली ("एक एसएसएल त्रुटि आई है और सर्वर से एक सुरक्षित कनेक्शन नहीं बनाया जा सकता है।"), एक शून्य त्रुटि नहीं। यह जांचने के बाद कि समस्या कुछ आवंटन समस्या के बारे में नहीं है, अगर आपको अभी भी परेशानी है, तो आपको अपने मार्गों को दस्तावेज करना चाहिए और एक और प्रश्न खोलना चाहिए। –

9

में कुछ अद्यतन करने की जरूरत है अपने Info.plist फ़ाइल को यह जोड़े और त्रुटियों दूर जाना होगा। यदि आप एक्सएमएल कोड नहीं समझते हैं, तो नीचे स्क्रीनशॉट देखें। Xcode से

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSExceptionDomains</key> 
    <dict> 
     <key>facebook.com</key> 
     <dict> 
      <key>NSIncludesSubdomains</key> 
      <true/> 
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> 
      <false/> 
     </dict> 
     <key>fbcdn.net</key> 
     <dict> 
      <key>NSIncludesSubdomains</key> 
      <true/> 
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> 
      <false/> 
     </dict> 
     <key>akamaihd.net</key> 
     <dict> 
      <key>NSIncludesSubdomains</key> 
      <true/> 
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> 
      <false/> 
     </dict> 
    </dict> 
</dict> 

स्क्रीनशॉट है कि आप शुद्ध एक्सएमएल की तुलना में बेहतर मदद कर सकता है:, Here is a screenshot from Xcode that might help you better than the pure XML below.

+0

धन्यवाद, लड़का। क्या यह तेजी से किया था। – Felipe

0

अन्य विकल्प "मनमानी भार की अनुमति दें" करने के लिए है की स्थापना द्वारा NSAllowsArbitraryLoads कुंजी YES रहे हैं:

enter image description here

An optional Boolean value that, when set to YES, disables App Transport Security (ATS) for any domains for which you do not reenable ATS by using an exception domain dictionary.

अधिक जानकारी here>>