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.

Ron
  • 51
  • 1
  • 1
  • 5
  • 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 '15 at 16:52

1 Answers1

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.

Kex
  • 8,023
  • 9
  • 56
  • 129
  • 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 '15 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 '15 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 '15 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 '15 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 '15 at 18:13
  • I actually just made myself a single view app for my parse backend. All it does is upload images. I just run it on the simulator when I want to add something. – Kex Mar 19 '15 at 18:15
  • I won't down vote you because your half right. Although, saying there isn't __any__ other way to upload bulk data outside of programmatically is misleading, it's half right. Half right in the sense that its an alternative. @Sree if you are familiar with REST API you can bulk upload data that way https://parse.com/docs/rest but both avenues require time and attention. It's just not fair to future question seekers to be told that the only alternative is coding????? What if they are familiar with REST API but see this answer and misinterpret it Kex – soulshined Mar 19 '15 at 19:28