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
, nsurl
s , 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:
- don't use quotation marks.
- 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
Post a Comment