iOS substitute current Assets with In App Purchase package content

My application has some images and icons for default, and I want them to change depending the In App Purchase content users will download.


Packages are uploaded to iTunes Connect and can be dowloaded and display icons in app, so it is working 50% fine, but icons are just images.


I need the app to recognise those images like assets, because I want the icons to change their resolution automatically to get a nice look.

Is this even possible? Thank you all.

Accepted Reply

I could fix it using this command:


[image setImage:[UIImage imageWithContentsOfFile:imagePath]];


You must have each .png image separated in different folders, with the correct json file inside them. Also the images must be correctly named. Here is an example:


someimage.imageset

  • someimage@2x.png
  • someimage@3x.png
  • Contents.json


imagePath would be the following:


NSString *source = [download.contentURL path];
NSString *imagePath = [source stringByAppendingPathComponent:@"Contents/.../someimage.imageset/someimage"];
[image setImage:[UIImage imageWithContentsOfFile:imagePath;

Replies

I could fix it using this command:


[image setImage:[UIImage imageWithContentsOfFile:imagePath]];


You must have each .png image separated in different folders, with the correct json file inside them. Also the images must be correctly named. Here is an example:


someimage.imageset

  • someimage@2x.png
  • someimage@3x.png
  • Contents.json


imagePath would be the following:


NSString *source = [download.contentURL path];
NSString *imagePath = [source stringByAppendingPathComponent:@"Contents/.../someimage.imageset/someimage"];
[image setImage:[UIImage imageWithContentsOfFile:imagePath;