Posts

Post not yet marked as solved
2 Replies
The error message is below. modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread
Post not yet marked as solved
2 Replies
Source Code. Changed to update UI on main thread. ex) dispatchsync(dispatchgetmainqueue(),^{   //UI update process }); [Camera Roll]  (IBAction)onTapPhotoLibraryBtn:(id)sender {     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {         switch (status) {             case PHAuthorizationStatusAuthorized: {                 // ユーザーが、アプリが写真のデータへアクセスすることを許可している                 // PHAssetを取得                 PHFetchResult *allPhotosResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:nil];                 if (allPhotosResult.count == 0) {                     UIAlertController *alert = [UIAlertController alertControllerWithTitle:@""                                                                                    message:@"カメラロールに写真がありません。"                                                                             preferredStyle:UIAlertControllerStyleAlert];                     [alert addAction:[UIAlertAction actionWithTitle:@"OK"                                                               style:UIAlertActionStyleDefault                                                             handler:nil]];                     [self presentViewController:alert animated:YES completion:nil];                     return;                 }                 dispatchsync(dispatchgetmainqueue(), ^{                                         //20200713                 imagePickerController = [QBImagePickerController new];                 imagePickerController.delegate = self;                 imagePickerController.allowsMultipleSelection = YES;                 //    imagePickerController.maximumNumberOfSelection = 6;                 imagePickerController.showsNumberOfSelectedAssets = NO;                 //    imagePickerController.mediaType = QBImagePickerMediaTypeImage;                 imagePickerController.showsNumberOfSelectedAssets = NO;                 imagePickerController.assetCollectionSubtypes = @[                                                                    @(PHAssetCollectionSubtypeSmartAlbumUserLibrary)                                                                    ];                 imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;      //20200713 //                imagePickerController.modalInPopover = YES;                                        //20200713                 [self presentViewController:imagePickerController animated:YES completion:NULL];                     });                                                                             //20200713                 break;             }             case PHAuthorizationStatusRestricted: {                 // PhotoLibraryへのアクセスが許可されていない時                 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"アプリ使用にはカメラへのアクセス許可が必要になります。iPhoneの「設定」機能から許可設定をおこなってください。" preferredStyle:UIAlertControllerStyleAlert];                 [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {                     // appの設定画面へ遷移                     NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];                     [[UIApplication sharedApplication] openURL:settingsURL];                 }]];                 [self presentViewController:alertController animated:YES completion:nil];                 break;             }             case PHAuthorizationStatusDenied: {                 // ユーザーが明示的に、アプリが写真のデータへアクセスすることを拒否した時                 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:@"アプリ使用にはカメラへのアクセス許可が必要になります。iPhoneの「設定」機能から許可設定をおこなってください。" preferredStyle:UIAlertControllerStyleAlert];                 [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {                     // appの設定画面へ遷移                     NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];                     [[UIApplication sharedApplication] openURL:settingsURL];                 }]];                 [self presentViewController:alertController animated:YES completion:nil];                 break;             }             default: {                 PHFetchResult *allPhotosResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:nil];                 if (allPhotosResult.count == 0) {                     UIAlertController *alert = [UIAlertController alertControllerWithTitle:@""                                                                                    message:@"カメラロールに写真がありません。"                                                                             preferredStyle:UIAlertControllerStyleAlert];                     [alert addAction:[UIAlertAction actionWithTitle:@"OK"                                                               style:UIAlertActionStyleDefault                                                             handler:nil]];                     [self presentViewController:alert animated:YES completion:nil];                     return;                 }                 break;             }         }     }]; } [Camera] (void) takePicture {      // カメラの利用     UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;     // カメラが利用可能かチェック     if ([UIImagePickerController isSourceTypeAvailable:sourceType]) {         dispatchsync(dispatchgetmainqueue(), ^{                                         //20200713         // インスタンスの作成         UIImagePickerController *cameraPicker = [[UIImagePickerController alloc] init];         // カメラから画像を取り込む設定にする         cameraPicker.sourceType = sourceType;         //UIImagePickerControllerDelegate のデリゲートになる         cameraPicker.delegate = self;                 // 撮影後に写真の編集を行うかどうか         cameraPicker.allowsEditing = YES;         //モーダルビューでカメラ起動         [self presentViewController:cameraPicker animated:YES completion:nil];         });                                                                                 //20200713     }     else{         // label.text = @"error";                 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"シミュレータではカメラは起動できません"                                                                        message:@"撮影できません"                                                                 preferredStyle:UIAlertControllerStyleAlert];         [alert addAction:[UIAlertAction actionWithTitle:@"OK"                                                   style:UIAlertActionStyleDefault                                                 handler:nil]];         [self presentViewController:alert animated:YES completion:nil];         return;     } }
Post not yet marked as solved
3 Replies
It was successful when I conducted it again on June 24th. The cause is unknown, but it has been resolved and will be closed. Thank You.
Post not yet marked as solved
3 Replies
Claude31 > Thank you for your comment. Thank you for introducing the developer site. I'll give it a try. What is the cause? The current version was 11.2. Capacity is no problem.