IOS获取相册照片的大小

xiaoxiao2021-02-27  155

     ALAssetsLibrary *alLibrary = [[ALAssetsLibrary alloc] init];

        __block float fileMB  = 0.0;

        

        [alLibrary assetForURL:[NSURL URLWithString:imgURL] resultBlock:^(ALAsset *asset) {

            

            ALAssetRepresentation *representation = [asset defaultRepresentation];

            

            fileMB = (float)([representation size]/HQKBTransformToMBCount);

            

            NSLog(@"图片大小=%fkb", fileMB);

            

        } failureBlock:^(NSError *error) {

            

        }];

转载请注明原文地址: https://www.6miu.com/read-14614.html

最新回复(0)