iOS Question Problem with DocumentPicker.Show

SDFP Studio

Member
Licensed User
Hello,

I have a problem with DocumentPicker.Show

This way it works fine on iPhone but the picker is not displayed on iPad :
B4X:
DocumentPicker.Show(MainPage,bt_Panel_Stockage_Tel)

This way it works fine on iPhone and most iPads but on one user's iPad I have an error report :
B4X:
DocumentPicker.Show(MainPage,NavControl)

Does anyone have any ideas? Thanks

Error report:
Incident Identifier: B758D7C6-E25A-4685-9156-5E73CF6CFA2B
CrashReporter Key:   cf0774ab7b9ef4d7fc3fa4410f9cdea9348f81ef
Hardware Model:      iPad5,4
Process:         ABMT Player [325]
Path:            /private/var/containers/Bundle/Application/1F40BFD8-2D13-4DDD-B42F-9351C301DECA/ABMT Player.app/ABMT Player
Identifier:      sdfpstudio.ABMusicTrainer
Version:         2.1.2 (2.1.2)
Code Type:       ARM-64
Parent Process:  ? [1]

Date/Time:       2024-07-08 20:38:54.000 +0300
OS Version:      iPadOS 15.8.2 (19H384)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x0000000000000000
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to set <B4INavigationController: 0x103019600> as source barButtonItem of <UIPopoverPresentationController: 0x101d72e00>, even though it is not a kind of UIBarButtonItem.'

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                  0x000000018180cc60 0x18177a000 + 601184 (<redacted> + 216)
1   libobjc.A.dylib                 0x000000019903cee4 0x199028000 + 85732 (objc_exception_throw + 56)
2   Foundation                      0x0000000182fb1c80 0x182e8d000 + 1199232 (<redacted> + 200)
3   UIKitCore                       0x0000000184342f60 0x183ab5000 + 8970080 (<redacted> + 220)
4   UIKitCore                       0x0000000184390c2c 0x183ab5000 + 9288748 (<redacted> + 292)
5   ABMT Player                     0x0000000101107ebc 0x100ff4000 + 1130172 (-[B4IDocumentPickerViewController Show::] + 536)
6   ABMT Player                     0x0000000101058b5c 0x100ff4000 + 412508 ( + 728)
7   ABMT Player                     0x0000000101083590 0x100ff4000 + 587152 ( + 112)
8   ABMT Player                     0x00000001010663a0 0x100ff4000 + 467872 ( + 132)
9   CoreFoundation                  0x000000018179acf0 0x18177a000 + 134384 (<redacted> + 144)
10  CoreFoundation                  0x00000001817b6dd8 0x18177a000 + 249304 (<redacted> + 300)
11  ABMT Player                     0x00000001010bb4c0 0x100ff4000 + 816320 (+[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1296)
12  ABMT Player                     0x00000001010bac30 0x100ff4000 + 814128 (-[B4I raiseEvent:event:params:] + 400)
13  ABMT Player                     0x00000001010baa88 0x100ff4000 + 813704 (__33-[B4I raiseUIEvent:event:params:]_block_invoke + 52)
14  libdispatch.dylib               0x00000001814cc094 0x181469000 + 405652 (<redacted> + 24)
15  libdispatch.dylib               0x00000001814cd094 0x181469000 + 409748 (<redacted> + 16)
16  libdispatch.dylib               0x0000000181479d44 0x181469000 + 68932 (<redacted> + 928)
17  libdispatch.dylib               0x0000000181479994 0x181469000 + 67988 (<redacted> + 36)
18  CoreFoundation                  0x00000001817c8014 0x18177a000 + 319508 (<redacted> + 12)
19  CoreFoundation                  0x00000001817854f8 0x18177a000 + 46328 (<redacted> + 2544)
20  CoreFoundation                  0x0000000181798174 0x18177a000 + 123252 (CFRunLoopRunSpecific + 572)
21  GraphicsServices                0x00000001a20d7988 0x1a20d6000 + 6536 (GSEventRunModal + 160)
22  UIKitCore                       0x0000000183f9aa88 0x183ab5000 + 5134984 (<redacted> + 1080)
23  UIKitCore                       0x0000000183d33f78 0x183ab5000 + 2617208 (UIApplicationMain + 336)
24  ABMT Player                     0x0000000100ff8060 0x100ff4000 + 16480 ( + 96)
25  (null) 0x0000000101a684d0 0x0 + 4322657488

Thread 1:
0   libsystem_kernel.dylib          0x00000001bb3b5014 0x1bb3b4000 + 4116 (__workq_kernreturn + 8)
1   libsystem_pthread.dylib         0x00000001dba18e4c 0x1dba17000 + 7756 (_pthread_wqthread + 360)

Thread 2 name:  com.apple.uikit.eventfetch-thread
Thread 2:
0   libsystem_kernel.dylib          0x00000001bb3b4aac 0x1bb3b4000 + 2732 (mach_msg_trap + 8)
1   libsystem_kernel.dylib          0x00000001bb3b507c 0x1bb3b4000 + 4220 (mach_msg + 72)
2   CoreFoundation                  0x0000000181780c88 0x18177a000 + 27784 (<redacted> + 368)
3   CoreFoundation                  0x0000000181784f90 0x18177a000 + 44944 (<redacted> + 1160)
4   CoreFoundation                  0x0000000181798174 0x18177a000 + 123252 (CFRunLoopRunSpecific + 572)
5   Foundation                      0x0000000182ea4eac 0x182e8d000 + 97964 (<redacted> + 232)
6   Foundation                      0x0000000182ee3fd0 0x182e8d000 + 356304 (<redacted> + 88)
7   UIKitCore                       0x0000000183f19ef4 0x183ab5000 + 4607732 (<redacted> + 512)
8   Foundation                      0x0000000182ef1bdc 0x182e8d000 + 412636 (<redacted> + 792)
9   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 3:
0   libsystem_kernel.dylib          0x00000001bb3b4fd0 0x1bb3b4000 + 4048 (__semwait_signal + 8)
1   libsystem_c.dylib               0x000000018bedea40 0x18beda000 + 19008 (nanosleep + 216)
2   libsystem_c.dylib               0x000000018bef2710 0x18beda000 + 100112 (sleep + 48)
3   ABMT Player                     0x0000000101302b54 0x100ff4000 + 3205972 ( + 132)
4   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 4 name:  KSCrash Exception Handler (Secondary)
Thread 4:
0   libsystem_kernel.dylib          0x00000001bb3b4aac 0x1bb3b4000 + 2732 (mach_msg_trap + 8)
1   libsystem_kernel.dylib          0x00000001bb3b507c 0x1bb3b4000 + 4220 (mach_msg + 72)
2   libsystem_kernel.dylib          0x00000001bb3c0810 0x1bb3b4000 + 51216 (thread_suspend + 92)
3   ABMT Player                     0x00000001012ff3c8 0x100ff4000 + 3191752 ( + 152)
4   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 5 name:  KSCrash Exception Handler (Primary)
Thread 5:
0   libsystem_kernel.dylib          0x00000001bb3b4aac 0x1bb3b4000 + 2732 (mach_msg_trap + 8)
1   libsystem_kernel.dylib          0x00000001bb3b507c 0x1bb3b4000 + 4220 (mach_msg + 72)
2   ABMT Player                     0x00000001012ff400 0x100ff4000 + 3191808 ( + 208)
3   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 6:
0   libsystem_kernel.dylib          0x00000001bb3b5014 0x1bb3b4000 + 4116 (__workq_kernreturn + 8)
1   libsystem_pthread.dylib         0x00000001dba18e4c 0x1dba17000 + 7756 (_pthread_wqthread + 360)

Thread 7 name:  com.apple.NSURLConnectionLoader
Thread 7:
0   libsystem_kernel.dylib          0x00000001bb3b4aac 0x1bb3b4000 + 2732 (mach_msg_trap + 8)
1   libsystem_kernel.dylib          0x00000001bb3b507c 0x1bb3b4000 + 4220 (mach_msg + 72)
2   CoreFoundation                  0x0000000181780c88 0x18177a000 + 27784 (<redacted> + 368)
3   CoreFoundation                  0x0000000181784f90 0x18177a000 + 44944 (<redacted> + 1160)
4   CoreFoundation                  0x0000000181798174 0x18177a000 + 123252 (CFRunLoopRunSpecific + 572)
5   CFNetwork                       0x000000018219cb9c 0x181f56000 + 2386844 (_CFURLStorageSessionDisableCache + 50420)
6   Foundation                      0x0000000182ef1bdc 0x182e8d000 + 412636 (<redacted> + 792)
7   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 8:
0   libsystem_kernel.dylib          0x00000001bb3b4b00 0x1bb3b4000 + 2816 (semaphore_timedwait_trap + 8)
1   libdispatch.dylib               0x000000018146d9d8 0x181469000 + 18904 (<redacted> + 60)
2   libdispatch.dylib               0x000000018146df64 0x181469000 + 20324 (<redacted> + 72)
3   libdispatch.dylib               0x000000018147c990 0x181469000 + 80272 (<redacted> + 312)
4   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 9:
0   libsystem_kernel.dylib          0x00000001bb3b4b00 0x1bb3b4000 + 2816 (semaphore_timedwait_trap + 8)
1   libdispatch.dylib               0x000000018146d9d8 0x181469000 + 18904 (<redacted> + 60)
2   libdispatch.dylib               0x000000018146df64 0x181469000 + 20324 (<redacted> + 72)
3   libdispatch.dylib               0x000000018147c990 0x181469000 + 80272 (<redacted> + 312)
4   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 10:
0   libsystem_kernel.dylib          0x00000001bb3b5014 0x1bb3b4000 + 4116 (__workq_kernreturn + 8)
1   libsystem_pthread.dylib         0x00000001dba18e4c 0x1dba17000 + 7756 (_pthread_wqthread + 360)

Thread 11:
0   libsystem_kernel.dylib          0x00000001bb3b4b00 0x1bb3b4000 + 2816 (semaphore_timedwait_trap + 8)
1   libdispatch.dylib               0x000000018146d9d8 0x181469000 + 18904 (<redacted> + 60)
2   libdispatch.dylib               0x000000018146df64 0x181469000 + 20324 (<redacted> + 72)
3   libdispatch.dylib               0x000000018147c990 0x181469000 + 80272 (<redacted> + 312)
4   libsystem_pthread.dylib         0x00000001dba1a338 0x1dba17000 + 13112 (_pthread_start + 116)

Thread 0 crashed with ARM-64 Thread State:

Binary Images:
       0x100ff4000 -        0x1013c3fff +ABMT Player arm64  <289410e50ce430d8ab9bf72d53fe3ff6> /private/var/containers/Bundle/Application/1F40BFD8-2D13-4DDD-B42F-9351C301DECA/ABMT Player.app/ABMT Player
       0x101930000 -        0x10193bfff  libobjc-trampolines.dylib arm64  <2803aa0e658f326ba220b998a0c81a3f> /usr/lib/libobjc-trampolines.dylib
       0x181469000 -        0x1814ebfff  libdispatch.dylib arm64  <9ccdbde315e13a45b3304a5e2c3f92bd> /usr/lib/system/libdispatch.dylib
       0x1814ec000 -        0x1814f6fff  libdyld.dylib arm64  <b4e8d45a832d372c9989a57cd433c31f> /usr/lib/system/libdyld.dylib
       0x1814f7000 -        0x181779fff  libicucore.A.dylib arm64  <562a8c22417c34c1b7aa5ca7fd827dce> /usr/lib/libicucore.A.dylib
       0x18177a000 -        0x181bb7fff  CoreFoundation arm64  <eec1287d059b38c89bc158a0c8b1e6c2> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
       0x181bb8000 -        0x181d83fff  CoreServices arm64  <f0acfb7c6c3936d7bb9bd0adf76c845e> /System/Library/Frameworks/CoreServices.framework/CoreServices
       0x181d84000 -        0x181dcafff  WirelessDiagnostics arm64  <0811a81d68d53fffac31635d0fe0d732> /System/Library/PrivateFrameworks/WirelessDiagnostics.framework/WirelessDiagnostics
       0x181dcb000 -        0x181e42fff  SystemConfiguration arm64  <324e75218781343c8a43deab68eeacf1> /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
       0x181e43000 -        0x181f55fff  CoreTelephony arm64  <8c7b6a902b753d67805bda8e5292c3f4>
……………………………

Extra Information:
Object referenced by NSException:
{
    "address": 4345402880,
    "type": "unknown"
}

Notable Addresses:
{}

Application Stats:
{
    "active_time_since_last_crash": 0,
    "active_time_since_launch": 0,
    "application_active": true,
    "application_in_foreground": true,
    "background_time_since_last_crash": 0,
    "background_time_since_launch": 0,
    "launches_since_last_crash": 1,
    "sessions_since_last_crash": 1,
    "sessions_since_launch": 1
}

CrashDoctor Diagnosis: Application threw exception NSInternalInconsistencyException: Tried to set <B4INavigationController: 0x103019600> as source barButtonItem of <UIPopoverPresentationController: 0x101d72e00>, even though it is not a kind of UIBarButtonItem.
Originated at or in a subcall of -[B4IDocumentPickerViewController Show::]
 

SDFP Studio

Member
Licensed User
In my app (not in b4xpages mode because I stuck to the idea that rotation cannot be managed natively, but maybe that has changed since) I hide the ToolBar and the NavigationBar.
B4X:
NavControl.NavigationBarVisible = False
NavControl.ToolBarVisible = False
Can I / should I still create a BarButton (which will be invisible) to provide it to DocumentPicker?
Thanks
 
Upvote 0

SDFP Studio

Member
Licensed User
I try with that
B4X:
Dim bb As BarButton
bb.InitializeCustom(bt_Panel_Stockage_Tel)
DocumentPicker.Show(MainPage,bb)
runs on iPhone, send for test on ipad
 
Upvote 0

SDFP Studio

Member
Licensed User
After my last modification I have that error
B4X:
Incident Identifier: 76195643-0D41-4209-8831-F01B6206E437
CrashReporter Key:   cf0774ab7b9ef4d7fc3fa4410f9cdea9348f81ef
Hardware Model:      iPad5,4
Process:         ABMT Player [369]
Path:            /private/var/containers/Bundle/Application/3AF497C9-04F8-4A26-BF84-18BE0175A707/ABMT Player.app/ABMT Player
Identifier:      sdfpstudio.ABMusicTrainer
Version:         2.1.4 (2.1.4)
Code Type:       ARM-64
Parent Process:  ? [1]

Date/Time:       2024-07-11 13:09:33.000 +0300
OS Version:      iPadOS 15.8.2 (19H384)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x0000000000000000
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[5]'

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                  0x0000000180bc0c60 0x180b2e000 + 601184 (<redacted> + 216)
1   libobjc.A.dylib                 0x00000001983f0ee4 0x1983dc000 + 85732 (objc_exception_throw + 56)
2   CoreFoundation                  0x0000000180cbb694 0x180b2e000 + 1627796 (<redacted> + 112)
3   CoreFoundation                  0x0000000180cb90b8 0x180b2e000 + 1618104 (<redacted> + 48)
4   CoreFoundation                  0x0000000180b4dd08 0x180b2e000 + 130312 (<redacted> + 184)
5   CoreFoundation                  0x0000000180b7771c 0x180b2e000 + 300828 (<redacted> + 44)
6   ABMT Player                     0x00000001006533e8 0x1005e8000 + 439272 ( + 332)
7   CoreFoundation                  0x0000000180b4ecf0 0x180b2e000 + 134384 (<redacted> + 144)
8   CoreFoundation                  0x0000000180b6add8 0x180b2e000 + 249304 (<redacted> + 300)
 
Upvote 0

SDFP Studio

Member
Licensed User
Hello Erel,
bt_Panel_Stockage_Tel is initialized because it is the one that triggers this procedure.
I added the following two lines to pass bb as a parameter.
B4X:
Dim bb As BarButton
bb.InitializeCustom(bt_Panel_Stockage_Tel)
DocumentPicker.Show(MainPage,bb)
The declaration is not enough for bb?
 
Upvote 0

SDFP Studio

Member
Licensed User
Here is the new code I tried

B4X:
Dim DocumentPicker As DocumentPickerViewController
DocumentPicker.InitializeImport("picker", Array("public.audio","public.movie"))
If Not(bb.IsInitialized) Then bb.InitializeCustom(bt_Panel_Stockage_Tel)
MainPage.TopLeftButtons = Array (bb)
DocumentPicker.Show(MainPage,bb)

and the error code

B4X:
Incident Identifier: 61A79F64-9896-4B4A-83D7-F8F88C1F57F6
CrashReporter Key:   cf0774ab7b9ef4d7fc3fa4410f9cdea9348f81ef
Hardware Model:      iPad5,4
Process:         ABMT Player [375]
Path:            /private/var/containers/Bundle/Application/6EDC366B-B84F-45F9-B9E5-A93EF277737B/ABMT Player.app/ABMT Player
Identifier:      sdfpstudio.ABMusicTrainer
Version:         2.1.5 (2.1.5)
Code Type:       ARM-64
Parent Process:  ? [1]

Date/Time:       2024-07-13 16:31:35.000 +0300
OS Version:      iPadOS 15.8.2 (19H384)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000 at 0x0000000000000000
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[5]'

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   CoreFoundation                  0x0000000182c60c60 0x182bce000 + 601184 (<redacted> + 216)
1   libobjc.A.dylib                 0x000000019a490ee4 0x19a47c000 + 85732 (objc_exception_throw + 56)
2   CoreFoundation                  0x0000000182d5b694 0x182bce000 + 1627796 (<redacted> + 112)
3   CoreFoundation                  0x0000000182d590b8 0x182bce000 + 1618104 (<redacted> + 48)
4   CoreFoundation                  0x0000000182bedd08 0x182bce000 + 130312 (<redacted> + 184)
5   CoreFoundation                  0x0000000182c1771c 0x182bce000 + 300828 (<redacted> + 44)
6   ABMT Player                     0x000000010100b590 0x100fa0000 + 439696 ( + 332)
7   CoreFoundation                  0x0000000182beecf0 0x182bce000 + 134384 (<redacted> + 144)
8   CoreFoundation                  0x0000000182c0add8 0x182bce000 + 249304 (<redacted> + 300)
9   ABMT Player                     0x00000001010677a8 0x100fa0000 + 817064 (+[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1296)
10  ABMT Player                     0x0000000101066f18 0x100fa0000 + 814872 (-[B4I raiseEvent:event:params:] + 400)
11  ABMT Player                     0x000000010109a350 0x100fa0000 + 1024848 (-[B4IAppDelegate application:openURL:sourceApplication:annotation:] + 400)
12  ABMT Player                     0x000000010118ebf0 0x100fa0000 + 2026480 (-[GULAppDelegateSwizzler application:openURL:sourceApplication:annotation:] + 332)
13  UIKitCore                       0x00000001852687fc 0x184f09000 + 3536892 (<redacted> + 948)
14  UIKitCore                       0x0000000185da2d24 0x184f09000 + 15310116 (<redacted> + 80)
15  UIKitCore                       0x0000000185da2bb8 0x184f09000 + 15309752 (<redacted> + 52)
16  UIKitCore                       0x0000000185857344 0x184f09000 + 9757508 (<redacted> + 68)
17  libdispatch.dylib               0x0000000182920094 0x1828bd000 + 405652 (<redacted> + 24)
18  libdispatch.dylib               0x0000000182921094 0x1828bd000 + 409748 (<redacted> + 16)
19  libdispatch.dylib               0x00000001828cdd44 0x1828bd000 + 68932 (<redacted> + 928)
20  libdispatch.dylib               0x00000001828cd994 0x1828bd000 + 67988 (<redacted> + 36)
21  CoreFoundation                  0x0000000182c1c014 0x182bce000 + 319508 (<redacted> + 12)
22  CoreFoundation                  0x0000000182bd94f8 0x182bce000 + 46328 (<redacted> + 2544)
23  CoreFoundation                  0x0000000182bec174 0x182bce000 + 123252 (CFRunLoopRunSpecific + 572)
24  GraphicsServices                0x00000001a352b988 0x1a352a000 + 6536 (GSEventRunModal + 160)
25  UIKitCore                       0x00000001853eea88 0x184f09000 + 5134984 (<redacted> + 1080)
26  UIKitCore                       0x0000000185187f78 0x184f09000 + 2617208 (UIApplicationMain + 336)
27  ABMT Player                     0x0000000100fa4060 0x100fa0000 + 16480 ( + 96)
28  (null) 0x00000001017e84d0 0x0 + 4320036048

I know Erel that you suggested me to make the declaration under the editor but I don't know which views to add.

I must admit that with b4i I feel completely lost, everything seems complicated to me, I can no longer make my mac work in local host for example, I use the hosted builder. I try to move forward from time to time on blocking points but it takes all the time I give myself to development.

This error occurs on a user's iPad (I don't know if he is the only one) on iPhones, it works, on an iPad that I was able to test it also works and on macos it also works.
It may be a false problem.

Thanks for your help but maybe I will let it go.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Solution
Cookies are required to use this site. You must accept them to continue using the site. Learn more…