I'm having trouble figuring out the NSBundle and DocumentDirectory data, I have a βImageβ of the βCameraβ image, which I save in NSDocumentDirectoy , and then want to get it for attaching to email,
Here's the saved code:
- (IBAction)saveImage { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; UIImage *image = imageView.image;
Here is the new data retrieval code:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; NSData *myData = [[[NSData alloc] initWithContentsOfFile:appFile] autorelease]; [picker addAttachmentData:myData mimeType:@"image/png" fileName:@"savedImage"];
ios email iphone nsdocument
Michael Robinson Jan 10 2018-10-10T00: 00
source share