Search code examples
objective-ciosuiimagensdataalasset

Is it possible to create an ALAsset object from NSData or other image type (CFImageRef, CIImage, UIImage)?


Is it possible to create an ALAsset object from NSData or other image type (CFImageRef, CIImage, UIImage)?

I don't want to save all of my applications images to the camera roll, but I want to be able to upload multiple images to Walgreen's QuickPrints API, which is a compiled library that only takes ALAssets for multiple image uploads.

Edit: My understanding of the Walgreen's API/SDK was incorrect. See my answer for details, if you want multiple images uploaded without using ALAssets, you'll have to upload them one at a time.


Solution

  • The real answer to this issue is that while Walgreen's documentation wasn't perfectly clear on this at the time of asking, the cart is tracked as batch with a limit of 100 photos, rather an upload being considered a batch.

    As long as you don't send the cart to the Walgreen's API, and receive a checkout URL with:

     [checkoutSDK postCart];
    

    It will keep track of all single and multiple uploads in a "batch" with a maximum limit of 100, rather than overwriting the previous cart with each call to:

     [checkoutSDK upload:someTypeOfImageData];
    

    Hopefully they'll add a bit more detail the documentation soon, if they haven't already.