2015-10-06 4 views
11

मैं एक एचटीएमएल आधारित वेबसाइट को एक्सकोड संस्करण 7.0.1 का उपयोग करके एक आईफोन ऐप के रूप में बंडल करना चाहता हूं, सब ठीक काम करता है और मेरा एकमात्र मुद्दा यह है कि जब मैं आईफोन 4 एस पर एप्लिकेशन का परीक्षण करता हूं, तो यह http के माध्यम से उपयोग की जाने वाली छवियों को नहीं दिखाएगा। हालांकि, मैं एक और वेबसाइट की छवियों तक पहुंच सकता हूं जो https अपनी छवियों तक पहुंच प्रदान करता है।xcode संस्करण 7.0.1 के प्लेस्ट करने के लिए NSExceptionDomains कैसे जोड़ें?

क्या बंडल में http समर्थन जोड़ने का कोई तरीका है?

अद्यतन

मैं अपने plist फाइल करने के लिए एक NSExceptionDomains जोड़ा है, लेकिन मैं अभी भी एक ही मुद्दा

<?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>English</string> 
    <key>CFBundleDisplayName</key> 
    <string>My Project</string> 
    <key>CFBundleExecutable</key> 
    <string>${EXECUTABLE_NAME}</string> 
    <key>CFBundleIcons</key> 
    <dict/> 
    <key>CFBundleIcons~ipad</key> 
    <dict/> 
    <key>CFBundleIdentifier</key> 
    <string>com.myproject.names</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>1.0</string> 
    <key>CFBundleName</key> 
    <string>${PRODUCT_NAME}</string> 
    <key>CFBundlePackageType</key> 
    <string>APPL</string> 
    <key>CFBundleShortVersionString</key> 
    <string>1.0.1</string> 
    <key>CFBundleSignature</key> 
    <string>myproject</string> 
    <key>CFBundleVersion</key> 
    <string>1.1</string> 
    <key>LSRequiresIPhoneOS</key> 
    <true/> 
    <key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSAllowsArbitraryLoads</key> 
     <true/> 
    </dict> 
    <key>UIMainStoryboardFile</key> 
    <string>Main_iPhone</string> 
    <key>UIMainStoryboardFile~ipad</key> 
    <string>Main_iPad</string> 
    <key>UIRequiresFullScreen</key> 
    <string>YES</string> 
    <key>UIStatusBarHidden</key> 
    <false/> 
    <key>UIStatusBarStyle</key> 
    <string>UIStatusBarStyleLightContent</string> 
    <key>UISupportedInterfaceOrientations</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
    </array> 
    <key>UISupportedInterfaceOrientations~ipad</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
    </array> 
    <key>UIViewControllerBasedStatusBarAppearance</key> 
    <false/> 
    <key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSExceptionDomains</key> 
     <dict> 
      <key>appanalytics.embarcadero.com</key> 
      <dict> 
       <key>NSExceptionAllowsInsecureHTTPLoads</key><true/> 
      </dict> 
     </dict> 
    </dict> 
</dict> 
</plist> 
है

मैं भी इस question

<dict> 
     <key>NSExceptionDomains</key> 
     <dict> 
      <key>mydomain.com</key> 
      <dict> 
       <!--Include to allow subdomains--> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <!--Include to allow HTTP requests--> 
       <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> 
       <true/> 
       <!--Include to specify minimum TLS version--> 
       <key>NSTemporaryExceptionMinimumTLSVersion</key> 
       <string>TLSv1.1</string> 
      </dict> 
     </dict> 
    </dict> 

के आधार पर निम्न की कोशिश की अद्यतन

मैंने here में उल्लिखित कोड जोड़ा लेकिन अभी भी एक ही समस्या है।

अद्यतन

के रूप में सुझाव दिया, मैं निम्नलिखित करने के लिए plist बदल लेकिन अभी भी एक ही समस्या है। इसके अलावा, मैंने बिना किसी लाभ के कुंजी टैग के मानों पर http: // जोड़ा।

<?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>English</string> 
    <key>CFBundleDisplayName</key> 
    <string>My Project</string> 
    <key>CFBundleExecutable</key> 
    <string>${EXECUTABLE_NAME}</string> 
    <key>CFBundleIcons</key> 
    <dict/> 
    <key>CFBundleIcons~ipad</key> 
    <dict/> 
    <key>CFBundleIdentifier</key> 
    <string>com.myproject.names</string> 
    <key>CFBundleInfoDictionaryVersion</key> 
    <string>1.0</string> 
    <key>CFBundleName</key> 
    <string>${PRODUCT_NAME}</string> 
    <key>CFBundlePackageType</key> 
    <string>APPL</string> 
    <key>CFBundleShortVersionString</key> 
    <string>3.1.6</string> 
    <key>CFBundleSignature</key> 
    <string>myproject</string> 
    <key>CFBundleVersion</key> 
    <string>1.2</string> 
    <key>LSRequiresIPhoneOS</key> 
    <true/> 
    <key>UIMainStoryboardFile</key> 
    <string>Main_iPhone</string> 
    <key>UIMainStoryboardFile~ipad</key> 
    <string>Main_iPad</string> 
    <key>UIRequiresFullScreen</key> 
    <string>YES</string> 
    <key>UIStatusBarHidden</key> 
    <false/> 
    <key>UIStatusBarStyle</key> 
    <string>UIStatusBarStyleLightContent</string> 
    <key>UISupportedInterfaceOrientations</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
    </array> 
    <key>UISupportedInterfaceOrientations~ipad</key> 
    <array> 
     <string>UIInterfaceOrientationPortrait</string> 
    </array> 
    <key>UIViewControllerBasedStatusBarAppearance</key> 
    <false/> 
    <key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSExceptionDomains</key> 
     <dict> 
      <key>myproject.com.ca</key> 
      <dict> 
       <key>NSExceptionAllowsInsecureHTTPLoads</key> 
       <true/> 
      </dict> 
      <key>myproject.com.ca</key> 
      <dict> 
       <key>NSIncludesSubdomains</key> 
       <true/> 
       <key>NSExceptionAllowsInsecureHTTPLoads</key> 
       <true/> 
      </dict> 
     </dict> 
    </dict> 
</dict> 
</plist> 
+0

कृपया यहां जाएं: https://nabla-c0d3.github.io/blog/2015/06/16/ios9-security-privacy/ –

उत्तर

10

सबसे पहले, आपकी Info.plist के दो अलग NSAppTransportSecurity कुंजी-मूल्य जोड़े हैं। आपको इसे ठीक करना चाहिए ताकि केवल एक जोड़ी हो।

आपका प्रश्न यह नहीं कहता कि आपकी छवियों को किस डोमेन से लोड किया गया है। यदि आप इस जानकारी को शामिल कर सकते हैं तो एक विशिष्ट उत्तर देना आसान होगा।

हैं, उदाहरण के लिए, आपकी छवियों example.com या उप से लोड किए गए हैं, इस प्रकार आप एक अपवाद जोड़ सकते हैं:

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSExceptionDomains</key> 
    <dict> 
     <key>appanalytics.embarcadero.com</key> 
     <dict> 
      <key>NSExceptionAllowsInsecureHTTPLoads</key> 
      <true/> 
     </dict> 
     <key>example.com</key> 
     <dict> 
      <key>NSIncludesSubdomains</key> 
      <true/> 
      <key>NSExceptionAllowsInsecureHTTPLoads</key> 
      <true/> 
     </dict> 
    </dict> 
</dict> 

आप पहले क्या छवियों से लोड किया जाएगा डोमेन में नहीं जानते हैं,

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
    <key>NSExceptionDomains</key> 
    <dict> 
     <key>appanalytics.embarcadero.com</key> 
     <dict> 
      <key>NSExceptionAllowsInsecureHTTPLoads</key> 
      <true/> 
     </dict> 
    </dict> 
</dict> 

ध्यान दें कि हालांकि इस दूसरे उदाहरण में appanalytics.embarcadero.com के शामिल किए जाने तकनीकी रूप से अनावश्यक है, यह अनुशंसित है कि आप सभी ज्ञात डोमेन वें के लिए एटीएस अपवाद निर्दिष्ट करें: तो आप के बजाय सभी डोमेन के लिए HTTP उपयोग की अनुमति देता कर सकते हैं आपके ऐप पर पहुंच होगी।

+0

धन्यवाद, मैं छवियों का डोमेन जानता हूं और कहा कि जैसा आपने सुझाव दिया था लेकिन नहीं किया मदद, मैंने सवाल अपडेट किया। – Jack

+0

आपके आखिरी अपडेट किए गए प्लिस्ट को देखते हुए-आपने मेरा उदाहरण भी शाब्दिक रूप से लिया, क्योंकि आपने एनएसईएक्सप्शनडोमेन में 'myproject.com.ca' के लिए दो अलग-अलग प्रविष्टियां शामिल की हैं। उस डोमेन के लिए आवश्यक अपवादों के साथ, आपके पास प्रत्येक डोमेन के लिए केवल एक प्रविष्टि होनी चाहिए। – adurdin

1

आप App Transport Security कॉन्फ़िगर करने के बारे इस ट्यूटोरियल पढ़ सकते हैं या यदि आप बस मूल्य "हाँ" अपने Info.plist में साथ एक बूलियन कुंजी के साथ जोड़ने शब्दकोश "NSAppTransportSecurity" नाम "NSAllowsArbitraryLoads" द्वारा के रूप में पहले सब कुछ दे सकता है।

1

आपका कुंजी नाम NSExceptionAllowsInsecureHTTPLoads है लेकिन यह NSTemporaryExceptionAllowsInsecureHTTPLoads

इसके अलावा, आप एटीएस डोमेन के प्रमुख के लिए

<key>NSExceptionRequiresForwardSecrecy</key> 
<false/> 

जोड़ने का प्रयास किया जाना चाहिए?
कुछ डोमेन को इसकी आवश्यकता होती है।

संबंधित मुद्दे