Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue- save an image file to resource folder in iphone
    primarykey
    data
    text
    <p>I am working on gallery kind of application. where user will tap image view to capture an image from camera. According to my requirement i need to save capture image in one specific folder in my device resource directory of the project. And that folder only i need to push on server. This is my code for capturing and writing into file...</p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; CGFloat compression = 0.5f; UIImage *smallSizeImage = [self scaleImage:image toSize:CGSizeMake(140.0, 80.0)]; imageData = UIImageJPEGRepresentation(smallSizeImage, compression); ivPicture.image = smallSizeImage; self.passingSlPosition.positionImageId = [Util getNewGUID]; [imageData writeToFile:[Util getFilePathForFileName:[NSString stringWithFormat:@"%@.jpg",self.passingSlPosition.positionImageId]] atomically:YES]; [picker dismissViewControllerAnimated:YES completion:nil]; } -(UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)newSize { UIGraphicsBeginImageContext(newSize); [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } </code></pre> <p>//Util class</p> <pre><code>+(NSString*)getFilePathForFileName:(NSString*)filename{ NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]; return [cachePath stringByAppendingPathComponent:filename]; } + (NSString *)getNewGUID { CFUUIDRef theUUID = CFUUIDCreate(NULL); CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); return (__bridge NSString *)string; } </code></pre> <p><img src="https://i.stack.imgur.com/K2kae.png" alt="enter image description here"> And After writing file , i am not able to see the file in resource using this path</p> <p>~/Library/Application Support/iphone simulator....</p> <p>Because I have not found the iphone simulator folder in Application Support.I have installed OS X 10.8.5 &amp; Xcode-4.6.3. So, can you please help me that what would be the following code for the above code? Please suggest some solution for this.</p> <p>Thanks.</p>
    singulars
    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.
    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