<img src="
assets-library://asset/asset.JPG?id=FF9A5A50-1954-474B-B9B8-A747EEA573CE&ext=JPG">
<img src="./img/sample.jpg">
<access origin="*" />
<allow-intent href="*" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self' *; connect-src *; img-src *; frame-src *; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-eval' 'unsafe-inline' *;">
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
ALAssetsLibrary *al = [[ALAssetsLibrary alloc] init];
[al writeImageDataToSavedPhotosAlbum:data metadata:metadataAsMutable completionBlock:^(NSURL *assetURL, NSError *error) {
if (assetURL) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: [assetURL absoluteString]];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:2];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackID];
}];
...
[al writeImageDataToSavedPhotosAlbum:data metadata:metadataAsMutable completionBlock:^(NSURL *assetURL, NSError *error) {
if (assetURL) {
// NG
//pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: [assetURL absoluteString]];
// OK
NSString* filePath = [weakSelf tempFilePath];
// save an image in app.
if (![data writeToFile:filePath atomically:YES]) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:2];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:filePath];
}
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:2];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:callbackID];
}];
For me, this worked wonders: In your URL, just replace "assets-library://" with "cdvfile://localhost/assets-library/". Boom, everything works again.