我正在使用XCode 6.3和Swift 1.2以及运行代码时:
ALAssetsLibrary().saveImage(screenshot, toAlbum: "myAlbum", completion:nil, failure:nil)
我收到错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ALAssetsLibrary saveImage:toAlbum:completion:failure:]: unrecognized selector sent to instance
我使用桥接头将Objective C代码与Swift链接
在构建阶段,我添加了MobileCoreService和AssetsLibrary框架
非常感谢任何帮助
答案 0 :(得分:1)
ALAssetsLibrary()。saveImage(screenshot,toAlbum:“myAlbum”,completion:nil,failure:nil)
为selector
提供function
。即,“myAlbum: