iOS 如何获取相册资源路径

获取方法如下:

使用PhotoKit框架

[[PHImageManager defaultManager] requestPlayerItemForVideo:videoAsset options:nil resultHandler:^(AVPlayerItem * _Nullable playerItem, NSDictionary * _Nullable info) {                            
      NSString *filePath = [info valueForKey:@"PHImageFileSandboxExtensionTokenKey"];            
      if (filePath && filePath.length > 0) {                   
           NSArray *lyricArr = [filePath componentsSeparatedByString:@";"];                    
           NSString *privatePath = [lyricArr lastObject];                   
           if (privatePath.length > 8) {                       
                NSString *videoPath = [privatePath substringFromIndex:8];                       
                NSLog(@"videoPath = %@",videoPath);                  
             }               
        }           
 }];

代码地址:

GitHub:https://github.com/YZQ-Nine/GetLocalVideo

你可能感兴趣的:(iOS)