objective c - Can't load images from file to ios device -


i loading in local images project. when run app on simulator images load fine. when run app on device images don't show up.

i've messed around several forms of loading in documents. nssearchpathfordirectoriesindomains, nsurls , such.

anyway, here works loading images simulator. (the code in loop , images named "1.jpg", "2.jpg", etc.

nsstring *pathname = [nsstring stringwithformat:@"%@%d%@",@"<filepath>", counter, @".jpg"]; uiimage *image = [uiimage imagewithcontentsoffile:pathname]; 

i notice when app runs on device, image in nil

you have 2 things wrong code:

  1. don't use quotation marks.
  2. you're not referencing app's main bundle. may sound stupid, yes, try executing nsstring:

...

nsstring *pathname = [[nsbundle mainbundle] pathforresource:[nsstring stringwithformat:@"%d", counter] filetype:@"jpg"]; 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -