Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving pictures taken in application and using core data
    primarykey
    data
    text
    <p>I am using core data to save the filenames for a set of images included in my application.</p> <pre><code> if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"]) { // app already launched } else { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"]; [[NSUserDefaults standardUserDefaults] synchronize]; // This is the first launch ever NSArray *mainDishImages = [NSArray arrayWithObjects:@"egg_benedict.jpg", @"full_breakfast.jpg", @"ham_and_cheese_panini.jpg", @"ham_and_egg_sandwich.jpg", @"hamburger.jpg", @"instant_noodle_with_egg.jpg", @"japanese_noodle_with_pork.jpg", @"mushroom_risotto.jpg", @"noodle_with_bbq_pork.jpg", @"thai_shrimp_cake.jpg", @"vegetable_curry.jpg", nil]; NSArray *drinkDessertImages = [NSArray arrayWithObjects:@"angry_birds_cake.jpg", @"creme_brelee.jpg", @"green_tea.jpg", @"starbucks_coffee.jpg", @"white_chocolate_donut.jpg", nil]; for (NSString *imagePath in mainDishImages) { NSManagedObjectContext *context = [self managedObjectContext]; NSManagedObject *newRecipe = [NSEntityDescription insertNewObjectForEntityForName:@"Recipe" inManagedObjectContext:context]; [newRecipe setValue:imagePath forKey:@"imageFilePath"]; } for (NSString *imagePath in drinkDessertImages) { NSManagedObjectContext *context = [self managedObjectContext]; NSManagedObject *newRecipe = [NSEntityDescription insertNewObjectForEntityForName:@"Deserts" inManagedObjectContext:context]; [newRecipe setValue:imagePath forKey:@"imageFilePath"]; } } </code></pre> <p>But I also allow the user to add items by taking a picture with the device camera. How can I save the image so my app can use it again, and integrate it to work with my existing core data scheme?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload