Does this link help? It explains that you will not get a URL for images but an image object instead.
How do i load an image from the IOS photo library to a UIWebView? [duplicate]
-
18-09-2022 - |
题
i have this code in my program but it seems to be crashing the program and i cant figure out why.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//Get Image URL from Library
NSURL *urlPath = [info valueForKey:UIImagePickerControllerMediaURL];
NSString *urlString = [urlPath absoluteString];
NSLog(urlString);
NSURL *root = [[NSBundle mainBundle] bundleURL];
NSString *html;
html = @"<img src='";
html = [html stringByAppendingString:urlString];
html = [html stringByAppendingString:@"' />"];
[MemeCanvas loadHTMLString:html baseURL:root];
[picker dismissViewControllerAnimated:YES completion:^{}];
}
It seems to be caused around the section where i append the asset-library address (urlString) to the the html string. i dont know why this would give a problem.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'
Any help is appreciated.
Thanks in advance.
解决方案
其他提示
I guess you need to save the image in documents directory and then display it in the webview.
不隶属于 StackOverflow