iOS Question PHAuthorizationStatus is Deprecated since IOS 14

Alexander Stolte

Expert
Licensed User
Longtime User
Hey, i'm using this objc code, to get access to the PHAsset.
B4X:
-(void) objc_RequestPermission
{
    [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status)
    {
        [self.bi raiseUIEvent:nil event:@"objc_RequestPermissionDone:" params:@[@((int)status)]];
    }];
}
How can i use the new method?

I'm using this class:
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Did it stop working?
The following error occurs since i set the "MinVersion" from 8 to 11
B4X:
Copying updated assets files (1)
Application_Start
Error occurred on line: 31 (PHAsset)
Method not found: objc_requestpermission, target: [_main=<b4i_main: (null)>, _b4xpages=<b4i_b4xpages: (null)>, _b4xcollections=<b4i_b4xcollections: (null)>
]
Stack Trace: (
  CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 40128
  libobjc.A.dylib      objc_exception_throw + 60
  CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 1012260
  B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 336
  B4i Example          -[B4INativeObject RunMethod::] + 176
  B4i Example          -[ResumableSub_phasset_RequestPermission resume::] + 1132
  B4i Example          -[b4i_phasset _requestpermission:] + 292
  B4i Example          -[ResumableSub_b4xmainpage_B4XPage_Created resume::] + 712
  B4i Example          -[b4i_b4xmainpage _b4xpage_created::] + 412
  CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 470020
 CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 134324
 B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1296
 B4i Example          -[B4ICommon CallSubDebug4::::] + 832
 B4i Example          -[B4ICommon CallSubDebug2::::] + 272
 B4i Example          -[b4i_b4xpagesmanager _createpageifneeded::] + 888
 B4i Example          -[b4i_b4xpagesmanager _showpage::] + 636
 B4i Example          -[b4i_b4xpagesmanager _addpage:::] + 1116
 B4i Example          -[b4i_b4xpagesmanager _addpageandcreate:::] + 488
 B4i Example          -[b4i_b4xpagesmanager _initialize:::] + 1408
 B4i Example          -[b4i_main _application_start:] + 540
 CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 470020
 CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 134324
 B4i Example          +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1296
 B4i Example          -[B4IShell runMethod:] + 420
 B4i Example          -[B4IShell raiseEventImpl:method:args::] + 1968
 B4i Example          -[B4IShellBI raiseEvent:event:params:] + 1360
 B4i Example          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 52
 libdispatch.dylib    BB347F0E-F21C-3607-82E6-C8D750FDBF8C + 8992
 libdispatch.dylib    BB347F0E-F21C-3607-82E6-C8D750FDBF8C + 16044
 libdispatch.dylib    BB347F0E-F21C-3607-82E6-C8D750FDBF8C + 75428
 libdispatch.dylib    _dispatch_main_queue_callback_4CF + 44
 CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 625704
 CoreFoundation       4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 501088
 CoreFoundation       CFRunLoopRunSpecific + 612
 GraphicsServices     GSEventRunModal + 164
 UIKitCore            B3834960-244B-34E4-9EA0-CA4BB44EF0F3 + 3790568
 UIKitCore            UIApplicationMain + 340
 B4i Example          main + 100
 dyld                 8A423F3F-B318-315E-99C7-05EE532E9C0D + 89580
)
Application_Active
The project is attached
Thanks
 

Attachments

  • PHAsset.zip
    6.2 KB · Views: 49
Upvote 0
Top