[英]App Transport Security
I know this question has been asked before but I have tried all the proposed solutions.我知道之前有人问过这个问题,但我已经尝试了所有建议的解决方案。 My info.plist file looks like this
我的 info.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>$(PRODUCT_BUNDLE_IDENTIFIER)</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>NSAppTransportSecurity</key>
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
<key>NSExceptionDomains</key>
<dict>
<key>parse.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
This error happens right after I pick an image on my application the code is in timelinetable view controller here.在我的应用程序上选择图像后,此错误立即发生,代码位于此处的时间表视图控制器中。
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
let pickedImage: UIImage = (info as NSDictionary).objectForKey(UIImagePickerControllerOriginalImage) as! UIImage
//Scale
let scaledImage = self.scaleImageWith(pickedImage, and:CGSizeMake(80, 80))
let imageData = UIImagePNGRepresentation(scaledImage)
let imageFile:PFFile = PFFile(name: "Profile", data: imageData )
let user = PFUser.currentUser()
user.setObject(imageFile, forKey: "profilePicture")
user.saveInBackgroundWithBlock {
(success: Bool, error: NSError?) -> Void in
if error == nil {
print("saving")
}
}
picker.dismissViewControllerAnimated(true, completion: nil)
I am using parse as my backend.我使用 parse 作为我的后端。
NSAppTransportSecurity
is nested in your .plist file that's why you are getting this issue. NSAppTransportSecurity
嵌套在您的 .plist 文件中,这就是您遇到此问题的原因。 I fixed your plist and it is stated below.我修复了您的 plist,如下所述。 Hope it will work for you.
希望它对你有用。
<?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>$(PRODUCT_BUNDLE_IDENTIFIER)</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>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.