iOS Question how I know album permission?

naifnas

Active Member
Licensed User
Hi all
how I know choose user app permission?
I have save photo in album so need permission
how i know allowe or not ?

Dim p As Phone
Dim b As Bitmap
b.Initialize(File.DirDocuments , "main.png")',100,100,True)
p.AddImageToAlbum(b)

i try this but give only false
Dim As NativeObject
Dim staute As Int = s.Initialize("PHPhotoLibrary").RunMethod("authorizationStatus", Null).AsNumber

#if OBJC

@import Photos;
-(void) objc_requestpermission
{
[PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status)
{
[self.bi raiseUIEvent:nil event:mad:"objc_requestpermission_done:" params:mad:[@((int)status)]];
}];
}
#end if
thankssssssssssssssssss
 

naifnas

Active Member
Licensed User
thank yo for replay
problem
the app need know user allow or not
if not most app give notice cant add image
if allow give notice success
thanks
 
Upvote 0

naifnas

Active Member
Licensed User
I used this
and work
B4X:
#If OBJC
#import <AssetsLibrary/AssetsLibrary.h>


-(void)savebitmap :(ALAssetsGroup*) albumhandle :(UIImage*) image
{

    CGImageRef img = [image CGImage];
    ALAssetsLibrary *library = [self defaultAssetsLibrary];

//  UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);


  [library writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){
    if (error) {
    [self.bi raiseEvent:nil event:@"savebitmap_result::"  params:@[@3,@"Error"]];

    } else {
   
   [self.bi raiseEvent:nil event:@"savebitmap_result::"  params:@[@1,@"Success"]];

    }
}];



}
#End If

with

B4X:
Sub Button1_Click
    Private wrk_bmp As Bitmap
    wrk_bmp.Initialize(File.DirAssets, "nas1.png")
    Dim Returned_album_handle As String
    SaveBitmap(Returned_album_handle, wrk_bmp)
    Wait For SaveBitmap_Result(status As String)
    Log("MyALAssets_SaveBitmap_Result: " & status)
End Sub

Public Sub SaveBitmap(Album_handle As Object, Image As Bitmap)
    noMe.RunMethod("savebitmap::", Array(Album_handle, Image))
End Sub

Private Sub SaveBitmap_Result(Photo_handle As Int, Status As String)
    Log(Status)
    Log(Photo_handle)
End Sub
 
Last edited:
Upvote 0
Top