Monday, October 23, 2023
HomeiOS Developmentios - CTAsssetspickerController not fetching modified photos from Gallery

ios – CTAsssetspickerController not fetching modified photos from Gallery


If i edit a picture in photographs app by including marker and altering
filters and attempt to connect the identical photograph in my iOS utility , it
exhibits all the photographs when pickercontroller opens up the gallery however
when the identical edited/modified picture is connected. it doesnt present up
these marker and added filters within the added cell picture. I’m utilizing
CTAssetspicker controller.

-(void)showPhotoLibraryForType:(NSString *)sort{
        // request authorization standing
        NSUserDefaults *userdefaults   = [NSUserDefaults standardUserDefaults];
       
        [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status){
            dispatch_async(dispatch_get_main_queue(), ^{
                [self hideOnlinestatusView];
                // init picker
                 CTAssetsPickerController *picker = [[CTAssetsPickerController alloc] init];
                picker.delegate = self;
                
                if ([type isEqualToString:filetypevideos]) {
                    [userdefaults setObject:@"2" forKey:@"mediaType"];
                    [userdefaults synchronize];
                    NSString *depend = APP_DELEGATE.settings.dict[@"MaxVideoSelectionMobile"];
                    if (depend) {
                        picker.totalAssets = [count integerValue];
                    }
                    NSString *maxLimitSize = APP_DELEGATE.settings.dict[@"MaxSizeOfVideoMobile"];
                    if (maxLimitSize) {
                        picker.maxLimitSize =  [maxLimitSize integerValue]  * 1048576;    //150000000;   // 150MB
                    }
                }
                else{
                    [userdefaults setObject:@"1" forKey:@"mediaType"];
                    [userdefaults synchronize];
                    BOOL showOldDocument = [APP_DELEGATE.settings.dict[@"ShowOldDocumentManagment"] boolValue];
                    if (!showOldDocument) {
                        NSString *depend = APP_DELEGATE.settings.dict[@"MaxImageSelectionMobile"];
                        if (depend) {
                            picker.totalAssets = [count integerValue];
                        }
                        NSString *maxLimitSize = APP_DELEGATE.settings.dict[@"MaxSizeOfImageMobile"];
                        if (maxLimitSize) {
                            picker.maxLimitSize =  [maxLimitSize integerValue]  * 1000000;    //10000000;   // 150MB
                        }
                    }
                }
               
                picker.showNewDocuments = YES ;
                
                // create choices for fetching photograph solely
                PHFetchOptions *fetchOptions = [PHFetchOptions new];
                
            
                if ([type isEqualToString:filetypeimages])
                {
                    fetchOptions.predicate = [NSPredicate predicateWithFormat:@"mediaType == %d", PHAssetMediaTypeImage];
                }
                else if ([type isEqualToString:filetypevideos])
                {
                    fetchOptions.predicate = [NSPredicate predicateWithFormat:@"mediaType == %d", PHAssetMediaTypeVideo];
                    
                }
                
                fetchOptions.includeAssetSourceTypes=PHAssetSourceTypeUserLibrary;
                // assign choices
                picker.assetsFetchOptions = fetchOptions;
                
                // conceal empty albums
                picker.showsEmptyAlbums = NO;
                // to point out choice order
                picker.showsSelectionIndex = YES;
                // Optionally current picker as a kind sheet on iPad
                if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
                    picker.modalPresentationStyle = UIModalPresentationFormSheet;
                // current picker
                [self presentViewController:picker animated:YES completion:nil];
                
            });
        }];
    }



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments