Swift can't retrieve images from parse.com

I was using 6.4 of Xcode and it was working fine but when I updated to Xcode 7 it seems like query isn’t working for photos.

I’m getting username on table view but the images not showing I get this error when testing on simulator iPhone 5:

  • UIImagePickerController really slow when calling alloc init
  • App rejected twice but cannot reproduce the issue on iOS 9.2. I need help identifying it
  • Animated reloadData on UITableView
  • StrongLoop Loopback example in Swift
  • iOS - Using storyboard and autolayout to center the UIScrollView
  • Bug in TWTweetComposeViewController?
  • App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.

    And when I test it on iPhone 6 I got this error :

    fatal error: unexpectedly found nil while unwrapping an Optional value
    (lldb)

    and showing me a red thread on this line :

    query.whereKey("user", equalTo: PFUser.currentUser()!.username!) 
    

    2 Solutions Collect From Internet About “Swift can't retrieve images from parse.com”

    Apple now forcing dev to use ATS(HTTPS), but you can disable it in info.plist by adding this

    <key>NSAppTransportSecurity</key>  
         <dict>  
              <key>NSAllowsArbitraryLoads</key><true/>  
         </dict>
    

    Should look like this enter image description here

    Visit Apple docs for more details about ATS and please watch this WWDC video session

    Your second issue is explain below

    FPUser.currentUser can return nil if user logged out, and you are using ! force unwrapping and then calling username, so if user is not logged in then currentUser will return nil and you will end up calling username on nil, hence you are getting this crash, you should do something like this.

    if let user = PFUser.currentUser()
    {
       query.whereKey("user", equalTo: user.username!) 
    }
    else
    {
       // show login ui 
    }
    

    Apple is now forcing HTTPS connections, that is the App Transport Security message. You are still sending over clear text HTTP.