2015-10-06 13 views
11

HTML tabanlı bir web sitesini Xcode Version 7.0.1 kullanarak iPhone uygulaması olarak paketlemek istiyorum, her şey iyi çalışıyor ve tek sorunum, uygulamayı iPhone 4s üzerinde test ettiğimde, http aracılığıyla erişilen görüntüleri göstermeyeceğidir. Ancak, resimlerine https erişimi sağlayan başka bir web sitesinin resimlerine erişebiliyordum.NSExceptionDomains, xcode Sürüm 7.0.1'den yararlanmaya nasıl eklenir?

Pakete http desteği eklemenin bir yolu var mı?

Güncelleme

benim plist dosyasına bir NSExceptionDomains eklendi, ama hala aynı sorunu

<?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> 
sahip

Ben de bu 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> 

dayalı aşağıdaki çalıştı Güncelleştirme

here'da belirtilen kodu ekledim ancak yine de aynı sorun var.

Güncelleme önerildiği gibi

, şuna plist değişti ama hala aynı sorunu var. Ayrıca, anahtar etiketlerin değerlerine yokken http: // ekledim.

<?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

lütfen ziyaret edin: https://nabla-c0d3.github.io/blog/2015/06/16/ios9-security-privacy/ –

cevap

10

İlk olarak, Info.plist'inizde iki ayrı NSAppTransportSecurity anahtar/değer çifti vardır. Bunu düzeltmelisin ki sadece bir çift var.

Sorunuz, resimlerinizin hangi etki alanlarından yükleneceğini söylemez. Bu bilgileri ekleyebilecekseniz belirli bir cevap vermek daha kolay olurdu.

varsa, örneğin, görüntüleri aşağıdaki gibi bir istisna ekleyebilirsiniz, example.com veya alt alanlardan gelen yüklenir:

<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> 

sizden yüklenecek görüntüleri alan adlarının ne olduğunu önceden bilmiyorsanız,

<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> 

Not bu ikinci örnekte appanalytics.embarcadero.com dahil teknik olarak gereksiz olmasına rağmen, bilinen tüm etki inci için ATS istisnalar belirtmeniz önerilir: o zaman bunun yerine tüm etki için HTTP erişim sağlar olabilir uygulamanızda erişecek.

+0

Görüntülerin alan adını biliyorum ve önerdiğiniz gibi değil yardım, sorunu güncelledim. – Jack

+0

Son güncellenmiş plist'inize baktığımda, NSExceptionDomains içinde myproject.com.ca için iki farklı girdi eklediniz. Bu alan adı için gerekli istisnalar dışında, her alan için yalnızca bir girişiniz olmalıdır. – adurdin

1

Bu eğiticiyi, App Transport Security'u nasıl yapılandıracağınız konusunda okuyabilirsiniz ya da daha önce olduğu gibi, "NSAllowsArbitraryLoads" adlı bir Boole anahtarını info.plist öğesinde "YES" değeriyle ekleyerek Sözlük "NSAppTransportSecurity" ekleyerek her şeye izin verebilirsiniz.

1

Anahtar isim NSExceptionAllowsInsecureHTTPLoads ama NSTemporaryExceptionAllowsInsecureHTTPLoads

Ayrıca

, ATS etki alanının anahtarına

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

eklemeyi deneyin vermedi olmalıdır?
Bazı alanlar bunu gerektirir.

İlgili konular