iOS Question AddImagetoAlbum Error

hongbii khaw

Member
Licensed User
Longtime User
Hi all,
I want to save the image to phone's album
I already added the
B4X:
#PlistExtra: <key>NSPhotoLibraryUsageDescription</key><string>This app needs access to photos.</string>
and i using the
B4X:
Dim phone As Phone
    phone.AddImageToAlbum(bitmap)

And i get this error
B4X:
SignalHandler 6
Error occurred on line: 7334 (Main)
Signal - 6
Stack Trace: (
    "0   SCloud               SignalHandler + 125",
    "1   libsystem_platform.dylib            0x0000000110a85b3a _sigtramp + 26",
    "2   ???                  0x0 + 123145437484840",
    "3   libsystem_kernel.dylib              0x0000000110a5e34f fcntl + 0",
    "4   TCC                  __TCCAccessRequest_block_invoke_2.85 + 0",
    "5   TCC                  __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 0",
    "6   TCC                  __tccd_send_block_invoke + 274",
    "7   libxpc.dylib         _xpc_connection_reply_callout + 36",
    "8   libxpc.dylib         _xpc_connection_call_reply_async + 82",
    "9   libdispatch.dylib    _dispatch_client_callout3 + 8"
)

anyone can help?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Works here with this code:
B4X:
#PlistExtra:<key>NSPhotoLibraryAddUsageDescription</key><string>Save photo in albums.</string>

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'Public variables can be accessed from all modules.
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page

End Sub

Private Sub Application_Start (Nav As NavigationController)
   'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.LoadLayout("1")
   NavControl.ShowPage(Page1)
End Sub

Sub Button1_Click
   Dim p As Phone
   p.AddImageToAlbum(LoadBitmap(File.DirAssets, "fade.png"))
End Sub

You should see a permission dialog on the first time that you try to add an image.
 
Upvote 0
Top