Open renzrivero opened 1 year ago
You seem to swallow exceptions in this code which is problematic. Please always use at least Log.e(ex)
in the catch body. Also please connect the device with a cable and look through the logcat output for an error message. This might provide us with information of what went wrong.
Thanks for the reply!
I have added Log.e(ex) in the catch body but the problem occurs with the FileChooser.showOpenDialog line where it doesn't open anything for iOS while it does for Android but doesn't allow users to pick a file.
Other feedback on top of the Assertion failure error I've given is the following:
I have also noticed that I've ran 'Update Codename One' which succeeds, but when I run 'Codename One Settings' the window that pops up shows me all the extensions I use that needs updating such as cn1-filechooser. It gets stuck on removing a previously installed version when I do update though.
You seem to swallow exceptions in this code which is problematic. Please always use at least
Log.e(ex)
in the catch body. Also please connect the device with a cable and look through the logcat output for an error message. This might provide us with information of what went wrong.
Connected an Android Device and got this through the logcat output (error at the very bottom):
ViewPostIme pointer 0 2023-02-09 11:43:44.498 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
I ViewPostIme pointer 1 2023-02-09 11:43:44.529 15204-15316 System.out com.codename1.myproject
I Is available 2023-02-09 11:43:44.607 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
I MSG_WINDOW_FOCUS_CHANGED 0 0 2023-02-09 11:43:44.727 15204-15204 InputTransport com.codename1.myproject
D Input channel destroyed: 'ClientS', fd=148 2023-02-09 11:43:45.098 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
I handleAppVisibility mAppVisible = true visible = false 2023-02-09 11:43:45.099 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
I stopped(true) old = false 2023-02-09 11:43:45.099 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
D WindowStopped on com.codename1. myproject/com.codename1.myproject.MyApplicationMainStub set to true 2023-02-09 11:43:45.119 15204-15204 MSHandlerLifeCycle com.codename1.myproject
I removeMultiSplitHandler: no exist. decor=DecorView@241663e[MyApplicationMainStub] 2023-02-09 11:43:45.121 15204-15312 OpenGLRenderer com.codename1.myproject
D setSurface called with nullptr 2023-02-09 11:43:45.121 15204-15312 OpenGLRenderer com.codename1.myproject
D setSurface() destroyed EGLSurface 2023-02-09 11:43:45.121 15204-15312 OpenGLRenderer com.codename1.myproject
D destroyEglSurface 2023-02-09 11:43:45.131 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
D performTraversals mFirst=false windowShouldResize=false viewVisibilityChanged=true mForceNextWindowRelayout=false params={(0,0)(fillxfill) sim={state=always_hidden adjust=pan} ty=BASE_APPLICATION wanim=0x1030309 fl=81810100 pfl=12020040 bhv=DEFAULT fitSides= naviIconColor=0} 2023-02-09 11:43:45.139 15204-15204 ViewRootIm...nMainStub] com.codename1.myproject
I Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)8 dur=7 res=0x2 s={false 0x0} ch=false seqId=0 2023-02-09 11:43:45.140 1256-4720 WindowManager system_server
E win=Window{ba39db1 u0 com.codename1.myproject/com.codename1.myproject.MyApplicationMainStub} destroySurfaces: appStopped=true cleanupOnResume=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8 caller=com.android.server.wm.ActivityRecord.destroySurfaces:6428 com.android.server.wm.ActivityRecord.destroySurfaces:6409 com.android.server.wm.ActivityRecord.notifyAppStopped:6473 com.android.server.wm.ActivityRecord.activityStopped:7060 com.android.server.wm.ActivityClientController.activityStopped:258 android.app.IActivityClientController$Stub.onTransact:613 com.android.server.wm.ActivityClientController.onTransact:136 `
Just tested the FileChooserDemo on Android (running API 30). Seemed to work OK.
What device/version were you trying on @renzrivero ?
Just tried on Android API 33 now, and it seemed to also work OK, loading a text file using the filechooser (The FIleChooserDemo app).
Thank you for replying @shannah !
I am testing on an Android Version 13 device and .txt
files can be chosen just fine, but it won't work any other files that I've passed on as an accepted mime type such as a .gpx
file.
On the other hand, the file browser that should pop up does not at all for iOS devices. When the FileChooser.showOpenDialog()
method is called, it outputs that it is available, but then gives out the following errors:
*** Assertion failure in -[UIDocumentMenuViewController _commonInitWithCompletion:], UIDocumentMenuViewController.m:125
Unknown platform linking against CloudDocs framework 7
We have the proper iOS setup required to use FileChooser and everything works on the Codename One simulator.
Thank you again, Renz
Update
On Android, I have now done a work around by just accepting all types of files (FileChooser.showOpenDialog(".*")
) and having a response logic to users whether or not the file they tried to load is accepted. Not the best user experience, but at least it is working! The same issue for iOS still exist though
That error "Unknown platform linking against CloudDocs framework 7" is reported in a couple of other places online, but no solutions posted.
I'm still seeing this error on iOS:
*** Assertion failure in -[UIDocumentMenuViewController _commonInitWithCompletion:], UIDocumentMenuViewController.m:125
I raised a bug on https://github.com/shannah/cn1-filechooser/issues/6 in case that was a more visible location...
Describe the bug Having the codename one libraries updated and double checking that FileChooser.isAvailable() returns true, I get an error when opening a file on an iOS 16 device:
*** Assertion failure in -[UIDocumentMenuViewController _commonInitWithCompletion:], UIDocumentMenuViewController.m:125
It was working as expected until our recent build update. This update build on iOS just won't allow users to search for files at all while Android allows users to search for files but not select anything.
To Reproduce Here's a snippet of code to reproduce: if (FileChooser.isAvailable()) { FileChooser.showOpenDialog(".txt, text/plain", e2->
{
String file = ""; try{ file = (String)e2.getSource(); } catch(Exception ex){} }); }