美文网首页
This application is modifying th

This application is modifying th

作者: 怎么老是ni | 来源:发表于2020-03-16 11:05 被阅读0次
    报错 报错堆栈

    报错原因:在子线程中做了操作UI的操作

    问题代码:

     
    @weakify(self);
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
          @strongify(self);
          // 获得全部相片
          PHFetchResult<PHAssetCollection *> *cameraCollections = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary options:nil];
          // 获得个人收藏相册
          PHFetchResult<PHAssetCollection *> *favoritesCollections = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeSmartAlbumFavorites options:nil];
          // 获得相机胶卷
          PHFetchResult<PHAssetCollection *> *assetCollections = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary options:nil];
      });
    

    原因:iOS13之后PHCollection获取相册只能在主线程中进行

    代码修改之后:


    image.png

    相关文章

      网友评论

          本文标题:This application is modifying th

          本文链接:https://www.haomeiwen.com/subject/ufowehtx.html