IOS - adding images takes long time (core data) : How can I make the way I add images to the core data more efficient? It's taking 30 seconds to complete with this code.

    for(int i = 0; i<photonum; i++){ //Fetch all the missing user ids
                NSString *str = [NSString stringWithFormat:@"http://%@/%@%@", httpPath, photoPath,[NSString stringWithFormat:@"%@.JPG",[[photoless objectAtIndex:i] valueForKey:@"user_id"]]];
                NSData *imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: str] options:0 error:&error];
                if(error){
                    NSLog(@"Error, image with path %@ not found", str);
                    NSLog(@"Error : %@ %@", error,error.localizedDescription);
                    continue;
                }
                // Set the student picture
                NSManagedObject *student = [photoless objectAtIndex:i];
                [student setValue:imageData forKey:@"photo"];
                [student.managedObjectContext save:&error];
                
            }

