我从服务器获取了 .svg 的链接,如何将这些链接中的 NSData 转换为 UIImage。我获取的链接形式类似 "https://storage.googleapis.com/pgcdn/ca/svg/lock.svg",我使用以下代码:
NSURL *url = [NSURL URLWithString:urlString];
dispatch_queue_t callerQueue = dispatch_get_main_queue();
dispatch_queue_t downloadQueue = dispatch_queue_create("com.test.svg", NULL);
dispatch_async(downloadQueue, ^{
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:imageData];
});
此函数返回的图像值为nil。