Collaborne / cordova-gallery-api

API to play with media gallery.
MIT License
3 stars 13 forks source link

getMedia crashes the application #2

Open orgotech-robin opened 5 years ago

orgotech-robin commented 5 years ago

I can fetch the albums perfectly but when trying to access Media from the Album the app crashes. Its a COPY PASTE of readme example.

ankon commented 5 years ago

Do you have any log messages? Can you expand a bit on the specifics of the device you're using (make/model, OS version, ...)?

Just saying "It crashes" doesn't really help in improving the software, as ... "It doesn't crash" is how we would describe our use of it :)

orgotech-robin commented 5 years ago

Of course. :) iPhone X (11.4.1)

2019-01-03 10:34:17.395600+0100[2778:692284] -[NSTaggedPointerString objectForKeyedSubscript:]: unrecognized selector sent to instance 0xa51c50016ca8c8cb
2019-01-03 10:34:17.396299+0100[2778:692284] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString objectForKeyedSubscript:]: unrecognized selector sent to instance 0xa51c50016ca8c8cb'

First throw call stack:

(0x18372ed8c 0x1828e85ec 0x18373c098 0x1837345c8 0x18361a41c 0x102c45890 0x1034e51dc 0x1034e519c 0x1034f1200 0x1034f67c8 0x1034f6500 0x183353fac 0x183353b08)
libc++abi.dylib: terminating with uncaught exception of type NSException

Appreciate the help! :)

UpriseNate commented 4 years ago

On Android, I get a similar behavior (crash on getMedia) and the error that is returned to me is "java.lang.String cannot be cast to org.json.JSONObject"

wuori commented 4 years ago

This issue (the crash) can be resolved by passing the entire album object to galleryAPI.getMedia vs. just the title.

Ex: galleryAPI.getMedia(album) vs. galleryAPI.getMedia(albumName)

Still can't get an album list on Android, but I'm working on these issues to see what I can do. I have very little iOS/Java experience so it's... painful.

kssham commented 3 years ago

In "platforms\android\app\src\main\java\com\subitolabs\cordova\galleryapi\GalleryAPI.java"GalleryAPI.java" Change JSONObject object = (JSONObject) args.get(0); ArrayOfObjects albums = getMedia(object.getString("title")); to String object = (String) args.get(0); ArrayOfObjects albums = getMedia(object);

This works fine for me. Thank you