Is there a sample for ALAssetsLibrary

For iPhone 4, many APIs can no longer be used.

I am looking for an alternative solution for UIImageWriteToSavedPhotosAlbum.

ALAssetsLibrary is Apple's current solution in the new iOS 4.

Does anyone have experience for this and can give some examples or open source projects?

thank

+3
source share
1 answer

you need to do something like this -

ALAssetsLibrary* library=[[ALAssetsLibrary alloc] init] ; 
// Request to save the image to camera roll
[library writeImageToSavedPhotosAlbum:img.CGImage orientation:(ALAssetOrientation)img.imageOrientation 
    completionBlock:^(NSURL* assetURL, NSError* error) {
        if (error != NULL)
            // Show error message...
        else  // No errors
            // Show message image successfully saved
    }] ;

Although I'm going crazy, trying to figure out how to keep this code compatible with the iphone 3 SDK.

+5
source

Source: https://habr.com/ru/post/1762654/


All Articles