我有ALAssetsLibrary从相机返回的图像。现在,我想在UIImageView中显示它。我试过这段代码,但它显示了一些错误:varassets:ALAsset=photoArray.objectAtIndex(indexPath.row)asALAssetcell.cameraOutlet.image=UIImage(CGImage:assets.thumbnail())asUIImage//Showingerror-Missingargumentforparameter'inBundle'incall在那之后,我尝试了这段代码:varassets:ALAsset=(photo
如何获取ALAssets数组中每个项目的路径?我想获取图片以便我可以将它们添加到电子邮件中例如NSString*path=[[NSBundlemainBundle]pathForResource:@"sample"ofType:@"png"];NSData*myData=[NSDatadataWithContentsOfFile:path];[mailViewControlleraddAttachmentData:myDatamimeType:@"image/png"fileName:@"sample"];如何做到这一点? 最佳答案
我无法从我从ALAsset获得的url中检索NSData下面是我试过的代码:-我总是得到NSData为nil。NSData*webData=[NSDatadataWithContentsOfURL:[assetdefaultRepresentation].url];我也试过类似的方法NSData*webData1=[NSDatadataWithContentsOfURL:[[assetvalueForProperty:ALAssetPropertyURLs]valueForKey:[[[assetvalueForProperty:ALAssetPropertyURLs]allKeys]
当我尝试访问照片流中的图片时,有时[assetdefaultRepresentation]方法返回nil。根据文档,如果Assets在本地(尚)不可用,则可能会发生这种情况。Thismethodreturnsnilforassetsfromasharedphotostreamthatarenotyetavailablelocally.Iftheassetbecomesavailableinthefuture,anALAssetsLibraryChangedNotificationnotificationisposted.一旦我在Photos.app中查看照片,它也可用于我的应用程序,但