0

I am developing an app which basically is like a wallpaper app. I want to use Parse as the back end. How do I make different categories and upload large number of files to each category? I tried with uploading one at a time manually, but with large number of files it is cumbersome.

1
  • are wallpapers custom objects or just UIImages ? Ie have you made a custom wallpaper call that contains variables such as wallpaperImage, wallpaperTitle etc
    – Kex
    Mar 19, 2015 at 16:52

1 Answer 1

0

If you have your wallpaper objects in an array can do it like this:

for(wallPaper *wallpaper in someArray) {

        PFObject *wallpaper = [PFObject objectWithClassName:@"wallpaper"];
        wallpaper[@"title"]=wallpaper.title;
        UIImage *image = wallpaper.image;
        NSData *imageData = UIImageJPEGRepresentation(image, 1);
        PFFile *imageFile = [PFFile fileWithName:@"wallpaper.jpg" data:imageData];
        [imageFile saveInBackground];
        [wallpaper setObject:imageFile forKey:@"wallpaperImage"];
        [wallpaper saveInBackground];


    }

You could also have a separate class "category". Each object in "category" has the category name i.e. "beaches" then have a PFRelation "members" pointing to which wallpapers belong to that category.

7
  • Thanks Kex for the reply. But I want to add the images to the server in the Parse app not from the mobile app I am developing. The Mobile app has to fetch the images from the Parse server and display in the app.
    – Ron
    Mar 19, 2015 at 18:00
  • You mean you want to upload images using the Parse website? The website doesn't have a nice way to do this. Can only upload one at a time. You can't even delete an image from the control panel. Best bet is just to upload it in code. Make yourself a separate upload app using the same Parse server and upload via that.
    – Kex
    Mar 19, 2015 at 18:04
  • Yes that's what I meant. So there is no way other than manually adding those images to the categories?
    – Ron
    Mar 19, 2015 at 18:09
  • Kex Please feel free to edit my question and add your relevant answer to 'Answers' section so that it would be helpful to others.
    – Ron
    Mar 19, 2015 at 18:13
  • Nope. The website is good for setting up your classes with the fields etc you want. Gives you a nice visual interface, easier to understand. But when you are bulk adding data you want to be doing it via code.
    – Kex
    Mar 19, 2015 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.