keisuke
keisuke

Reputation: 61

Creating a MSSticker with a remote image

I am trying to figure out way to create MSStickers with images that are hosted on the web. I can create MSStickers with local images, e.g.:

NSString *imagePath = [[NSBundle mainBundle] pathForResource: @"image_name" 
                                                      ofType: @"png"];
NSURL *imageURL = [NSURL fileURLWithPath: urlString];
MSSticker *sticker = [[MSSticker alloc] initWithContentsOfFileURL: stickerURL
                                             localizedDescription: @"my-sticker"                                          
                                                            error: &err];

But I cannot do something like this:

NSString *imageURLString = @"https://my-cdn/my-sticker.png"; 
NSURL *imageURL = [NSURL urlWithString: urlString];
MSSticker *sticker = [[MSSticker alloc] initWithContentsOfFileURL: stickerURL
                                             localizedDescription: @"my-sticker"                                          
                                                            error: &err];

Upvotes: 2

Views: 1013

Answers (1)

RomOne
RomOne

Reputation: 2105

No, it's not possible for the moment. But you can do this, which is not that far from what you want:

  1. Download the picture from your server
  2. Store it on local directory of the device
  3. Use the URL of this local file to create your sticker
  4. Optional : If you don't need the image anymore, erase it from the directory

Upvotes: 2

Related Questions