Hi has anyone tried yet to programatically create a custom sticker programmatically with an animated apng file?
I've had no success but can state the following:
.apng file of correct dimensions and file size (300px * 300px) and < 500kb.
Can add this as a .png and it shows the first frame (not animated)
Changing file name to .apng causes an error to be raised upon inserting sticker to MS Message.
Have taken the approach of loading the apng into the project folder (not in Assets.xcassets) as the initialize sticker requires an NSURL which is not made availabe if apng is created as an iOS sticker.
Managed to user the same sequence in .GIF. this inserted correctly as a sticker.
Code below:
MSConversation *currentConversation = [self activeConversation];
NSURL *urlForSticker2 = [[NSBundle mainBundle] URLForResource:@"elephant_apng" withExtension:@"apng"];
MSSticker *challengeSticker2 = [[MSSticker alloc] initWithContentsOfFileURL:urlForSticker2 localizedDescription:@"My Sticker Localised" error:&myError];
[currentConversation insertSticker:challengeSticker2 completionHandler:^(NSError * error)
{
//HERE we get: error NSError * domain: @"com.apple.messages.stickers-error" - code: 8 0x0000600000058240
}];
So yes - keen to be able to overcome the error shown above.