Can't query images on Back4App

54 views
Skip to first unread message

rsegr...@gmail.com

unread,
Feb 20, 2017, 10:54:14 PM2/20/17
to back{4}app

I am having a problem when querying images in my app. I have a column in the user table that contains the users' images. When I try to get the data from that column, it shows weird errors. It seems to be related to Parse, and I have seen that others are having similar problems, but I don't see a good solution.


The UI freezes up, and it doesn't seem to be able to get the image data from the file. I get errors like the following over and over again:


2017-02-20 21:48:43.070389 BonApp[20160:4668014] [Error]: unsupported URL (Code: 100, Version: 1.14.2)

2017-02-20 21:48:43.072297 BonApp[20160:4668014] [Error]: Network connection failed. Making attempt 1 after sleeping for 1.224872 seconds.


Please help!


PS-- I have tried changing the query URL from 'https' to 'http' but that causes other problems-- the data seems to be mixed up as if the queries are pulled from the wrong row.

casag...@back4app.com

unread,
Feb 21, 2017, 8:07:59 AM2/21/17
to back{4}app
Hello Rick,

Can you show me an example url for images that shows those errors?

Best!

Rick Segrest

unread,
Feb 24, 2017, 10:12:10 PM2/24/17
to back{4}app
Hi, thanks for the help! I have made many changes trying to get this to work but here is the current method I am using to get the images (Swift 3):

    static func getUserImage(_ userId:String) -> UIImageView? {

        let query = PFQuery(className:"UserImage")

        query.whereKey("userId", equalTo:userId)

        

        var userPhotoView:UIImageView?

        var objects:[PFObject]?

        do {

            objects = try query.findObjects()

        } catch {

            print(error)

        }

        if let objects = objects {

            for object in objects {

                

                let tempPhoto = object["image"] asPFFile

                

                var imageData:Data?

                do {

                    imageData = try tempPhoto.getData()

                } catch {

                    print(error)

                }

                if let imageData = imageData {

                    let userPhoto = UIImage(data:imageData)!

                    userPhotoView = UIImageView(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: 42, height: 42)))

                    userPhotoView!.image = userPhoto

                }

                

                

            }

            

        }

        return userPhotoView

        

    }

Rick Segrest

unread,
Feb 25, 2017, 5:32:44 PM2/25/17
to back{4}app
For anyone having a similar problem, I managed to fix this and query the images successfully by taking the spaces out of the filename. I believe that this problem is caused by a bug in this version of the Parse Framework.

Thanks for the help. 
Reply all
Reply to author
Forward
0 new messages