-1

Trying to Display the load the image from the folder present on MAC desktop using path like (/Users/sai/Desktop/images/aaa.jpg) Which is created in plist file called Data.plist at item0. As im using NSBundle it is diaplying the image path but not loading the image from the desktop .I have done a lots of research still couldn't find the solution .Plz help me .Here is the code

NSString *path=[[NSBundle mainBundle]pathForResource:@"Data" ofType:@"plist"];
NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:path];
NSString *errorDesc = nil;
NSPropertyListFormat format;
NSDictionary *temp = (NSDictionary *)[NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];
NSArray *array=[NSArray arrayWithArray:[temp objectForKey:@"images"]];
NSString *object=[array objectAtIndex:0];
 NSLog(@"object at index i %@",[object lastPathComponent]);
NSString *image=[object lastPathComponent];
mImageView.image=[UIImage imageNamed:image];
[self.view addSubview:mImageView];

Here is the screen shot of Data.plist

Here is the screen shot of Data.plist

lreddy
  • 391
  • 4
  • 17

1 Answers1

1

Simple and Short answer : It is not Possible to get image from MAC desktop, So please it better to stop fighting with it :)

It is different for mobile (iPhone application) and desktop (mac application), but why you want to do this ?? you know that your iOS application install in Apple iPhone ???? if your application is related to iOS ? then how you connect it to MAC OS ??

Best and simple way is put this image in Application Bundle or your Application's document directory and get it.

iPatel
  • 41,165
  • 13
  • 109
  • 131
  • As now im working in simulator im trying to take image from system .And i had a doubt whether it is possible or not with you answer it is cleared it is not. – lreddy Aug 20 '13 at 04:49
  • you can get any content from either bundle or document directory :) – iPatel Aug 20 '13 at 04:53
  • actually im trying to select the particular image from other folders which is present in the iphone device using path of that image.Will you suggest a answer for this? – lreddy Aug 20 '13 at 04:54
  • where is your image ?? your folder place ? – iPatel Aug 20 '13 at 04:55
  • something like if we create a new folder in device and moving some images to that folder.i need to select a image from that new folder and display it in image view where the path of the image should be given in .plist file.Is it possible to do like this way? – lreddy Aug 20 '13 at 05:01
  • @iPatel..haven't given u the downvote..rather upvoted it now :-) – Master Stroke Aug 20 '13 at 05:15