iOS Question I am using ALAssets library, but I can't save a picture on album

omarruben

Active Member
Licensed User
Longtime User
hi, I am using the awesome library ALAssets, but when I try to save a picture on a specific album the app explodes🤣,

the library is on the link :

test:
'groupx = familyphotos

Dim bmp As Bitmap
Dim MyPhotos As ALAssets

MyPhotos.Initialize(Me,"MyPhotos")

    MyPhotos.CreateAlbum(groupx)
    MyPhotos.AddBitmapToAlbum(groupx,bmp) ' app explode

the album is created correctly, and the photo is saved on root of photos, but nothing on the specific album
any help? thank you
 

JordiCP

Expert
Licensed User
Longtime User
I used ALAssets time ago and worked nicely --> Just searched my code (probably, based on some example in the library thread). There are some differences.

Basically, after creating an album, you should wait until it is really created before storing anything in it.

The way to do it is:
  • Call MyPhotos.GetAssets immediatelly after creating the album, and wait for the MyPhotos_Ready event.
  • Since the 'MyPhotos_Ready' event means that the operation is finsihed but not that the folder is already created, as a sanity check, I'd call MyPhotos.GetAlbums and iterate through the resulting list
  • Only if the folder exists, then save the bitmap. If not, call MyPhotos.GetAssets again (and wait for the _Ready event) until it is already there :)
 
Upvote 0
Top