Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 在xcode7上出错。。。我能';t使用';新的();在xcode7上?_Swift - Fatal编程技术网

Swift 在xcode7上出错。。。我能';t使用';新的();在xcode7上?

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(

错误表示“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()

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