UIImageWriteToSavedPhotos相册选择器语法问题 [英] UIImageWriteToSavedPhotosAlbum Selector Syntax Issue
问题描述
努力使UIImageWriteToSavedPhotosAlbum迅速运行 但是问题在于它会抛出带有无法识别的选择器的NSInvalidArgumentException: 您能否建议我的语法出了什么问题以及如何正确指定此选择器?据我了解,每个:代表方法期望的1个参数,由于它具有3个参数,因此我给了3个. 谢谢! 如果您的方法是Objective-C方法,则选择器将类似于"saveImageCompleteImage:err:context:".您需要记住,参数是Objective-C名称的一部分,因此 Trying hard to get UIImageWriteToSavedPhotosAlbum to work in swift https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/index.html#//apple_ref/c/func/UIImageWriteToSavedPhotosAlbum The documentation is sadly ONLY in objective C. Here is my code: But the problem is that it throws the NSInvalidArgumentException with an unrecognized selector: Can you advise what is wrong with my syntax and how I properly specific this selector? From what I understand, each : represents 1 argument the method expects and since it has 3 parameters I gave it 3 :'s. Thanks! If your method were an Objective-C method, the selector would be something like "saveImageCompleteImage:err:context:". You need to remember that the parameters are part of the name in Objective-C, so 这篇关于UIImageWriteToSavedPhotos相册选择器语法问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'app.PhotoEditor<0x14a1e400> does not respond to selector
saveImageComplete:::'
"saveImageComplete:::"
并未指定在Swift中可以称为saveImageComplete(image:UIImage,err:NSError,context:UnsafePointer<()>)
的方法.func saveImage()
{
UIImageWriteToSavedPhotosAlbum(uiimage, self, "saveImageComplete:::", nil)
}
func saveImageComplete(image:UIImage,err:NSError,context:UnsafePointer<()>)
{
loadLastPhotoIntoGalleryIcon()
}
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'app.PhotoEditor<0x14a1e400> does not respond to selector
saveImageComplete:::'
"saveImageComplete:::"
doesn't specify a method that could be called saveImageComplete(image:UIImage,err:NSError,context:UnsafePointer<()>)
in Swift.