更新された画像のURLを出力する次のコードがあります
override func viewWillAppear(animated: Bool) {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "assetChange:", name: ALAssetsLibraryChangedNotification, object: nil) }
func assetChange(notification: NSNotification){
if var info:NSDictionary = notification.userInfo { var url:NSSet = info.objectForKey(ALAssetLibraryUpdatedAssetsKey) as NSSet
var aurl:NSURL = url.anyObject() as NSURL
println(aurl)
}
}
このコードは正常に動作しますが、最初に変更された画像の URL のみが出力されますが、変更された画像の URL (変更された画像の配列) のすべてのリストが必要です。