在xcode7上出错...我不能在xcode7上使用'new()'?

时间:2016-01-16 07:29:22

标签: swift

错误表示'new()'不适用于Swift :: use对象初始值设定项。不知道如何解决......

   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)
    }
}

1 个答案:

答案 0 :(得分:1)

只需将NSMutableArray.new()更改为NSMutableArray()