Can I use the personal memoji sticker for the profile picture in the App I'm developing?
I will need a direct access to the user's memoji to set as the profile picture. how can I do that?
Thank you!
Can I use the personal memoji sticker for the profile picture in the App I'm developing?
I will need a direct access to the user's memoji to set as the profile picture. how can I do that?
Thank you!
Bump (+1) I like to know this as well.
When you go to Settings > Game Center. You will notice you can easily choose and create an avatar by tapping the profile picture. I like my app to do the same. I want to call a sheet in SwiftUI that will return an Avatar Image so I can use that as the profile picture.
we found a way to do it via the UITextView based on various notes online
on the UITextView:
.allowsEditingTextAttributes = YES;
(the above allows memoji to show in keyboard ; note that
the user must have memoji switch on in his Settings/General/Keyboard)
// subclass UITextView and override the paste: function (or modify the paste: function if you have it)
// this is objC , swifties can figure out the swift
// this handles memoji as image; there are rumors that you can get it as GIF but we havent tried that yet
- (void)paste:(id)sender
{
// handle memoji still image selection which results in a paste
UIImage *image = [[UIPasteboard generalPasteboard] image];
// you can use this image do put into a UIImageView or do whatever you want with it
// here we take it and put it in the UITextView
if (image) {
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
textAttachment.image = image;
NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:textAttachment];
[self setAttributedText:string];
}
else {
// do ordinary paste stuff for regular text paste
[super paste:sender];
}
}