This application is modifying the autolayout engine from a background thread after the engine was...

报错
报错堆栈

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

问题代码:

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

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

代码修改之后:


image.png

你可能感兴趣的:(This application is modifying the autolayout engine from a background thread after the engine was...)