Save the Photo to Album

Today is a day need to remember.That is I have been in trouble about how to save a photo in iPhone's album. spa

I used the method "UIImageWriteToSavedPhotosAlbum()" to deal with it,but also it will crash,I don't know why and debug half a day,because the crash location directly in main(),so we are hard to get the bug. debug

And when i use the method "writeImageToSavedPhotosAlbum:orientation:completionBlock:" to do, no crash, not any bug.So how is it? orm

Finally,I found the reason in the document: rem

" get

// Adds a photo to the saved photos album.  The optional completionSelector should have the form: it

//  - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; io

UIKIT_EXTERN void UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo); form

"

Oh,God!My completeHandler is wrong formation. Holy shit! sed

Blues bug

相關文章
相關標籤/搜索