Swift 在xcode7上出错。。。我能';t使用';新的();在xcode7上?
错误表示“new()”对Swift::不可用,请改用对象初始值设定项。不知道如何修复Swift 在xcode7上出错。。。我能';t使用';新的();在xcode7上?,swift,Swift,错误表示“new()”对Swift::不可用,请改用对象初始值设定项。不知道如何修复 func showImage(notif:NSNotification) { if let userInfo = notif.userInfo as NSDictionary! { //the code below is the one i got error for let photos:NSMutableArray = NSMutableArray.new(
func showImage(notif:NSNotification) {
if let userInfo = notif.userInfo as NSDictionary! {
//the code below is the one i got error for
let photos:NSMutableArray = NSMutableArray.new()
let photo:IDMPhoto = IDMPhoto(image: userInfo["img"] as! UIImage!)
photos.addObject(photo)
let browser:IDMPhotoBrowser = IDMPhotoBrowser(photos: photos as [AnyObject]!)
browser.delegate = self
browser.displayActionButton = false
self.presentViewController(browser, animated: true, completion: nil)
}
}
只需将
NSMutableArray.new()
更改为NSMutableArray()