mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(ios): UIImage.imageWithData.async is not a function
closes https://github.com/NativeScript/NativeScript/issues/8986
This commit is contained in:
@@ -154,8 +154,13 @@ export class ImageSource implements ImageSourceDefinition {
|
||||
return new Promise<ImageSource>((resolve, reject) => {
|
||||
try {
|
||||
const data = NSData.alloc().initWithBase64EncodedStringOptions(source, NSDataBase64DecodingOptions.IgnoreUnknownCharacters);
|
||||
UIImage.imageWithData['async'](UIImage, [data]).then((uiImage) => {
|
||||
resolve(new ImageSource(uiImage));
|
||||
const main_queue = dispatch_get_current_queue();
|
||||
const background_queue = dispatch_get_global_queue(qos_class_t.QOS_CLASS_DEFAULT, 0);
|
||||
dispatch_async(background_queue, () => {
|
||||
const uiImage = UIImage.imageWithData(data);
|
||||
dispatch_async(main_queue, () => {
|
||||
resolve(new ImageSource(uiImage));
|
||||
});
|
||||
});
|
||||
} catch (ex) {
|
||||
reject(ex);
|
||||
|
||||
Reference in New Issue
Block a user