We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cordova what uses PHAsset from the Photos framework instead of deprecated ALAsset.
Cordova target is iOS 10, but in CDVURLProtocol.m uses deprecated API from before iOS 9.0.
This causes XCode warnings, but code to refactoring is a few lines.
https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVURLProtocol.m This is deprecated code:
if ([[url absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset* asset) { if (asset) { // We have the asset! Get the data and send it along. ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation]; NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType); Byte* buffer = (Byte*)malloc((unsigned long)[assetRepresentation size]); NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:(NSUInteger)[assetRepresentation size] error:nil]; NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES]; [self sendResponseWithResponseCode:200 data:data mimeType:MIMEType]; } else { // Retrieving the asset failed for some reason. Send an error. [self sendResponseWithResponseCode:404 data:nil mimeType:nil]; } }; ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError* error) { // Retrieving the asset failed for some reason. Send an error. [self sendResponseWithResponseCode:401 data:nil mimeType:nil]; }; ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init]; [assetsLibrary assetForURL:url resultBlock:resultBlock failureBlock:failureBlock]; return; }
iOS
5.1
The text was updated successfully, but these errors were encountered:
Confirmed as a bug (see https://developer.apple.com/documentation/assetslibrary/alasset), thanks!
A pull request would definitely be welcome.
Sorry, something went wrong.
Seems to be resolved by PR #783
No branches or pull requests
Bug Report
Problem
What is expected to happen?
Cordova what uses PHAsset from the Photos framework instead of deprecated ALAsset.
What does actually happen?
Cordova target is iOS 10, but in CDVURLProtocol.m uses deprecated API from before iOS 9.0.
Information
This causes XCode warnings, but code to refactoring is a few lines.
Command or Code
https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Public/CDVURLProtocol.m
This is deprecated code:
Environment, Platform, Device
iOS
Version information
5.1
Checklist
The text was updated successfully, but these errors were encountered: