小编Rom*_*man的帖子

尝试在Swift中初始化UIActionSheet时的EXC_BAD_ACCESS

我的程序编译成功,但是当我按下按钮时,它会崩溃.这是viewController.swift:

import UIKit

class ViewController: UIViewController, UIActionSheetDelegate{

@IBOutlet var button:UIButton

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


@IBAction func buttonPressed(AnyObject) {
    let choice = UIActionSheet(title: "Select source", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, otherButtonTitles:"camera", "libary")
    choice.showInView(self.view)
}
}
Run Code Online (Sandbox Code Playgroud)

错误出现在这一行:

let choice = UIActionSheet(title: "Select source", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: nil, otherButtonTitles:"camera", "library") …
Run Code Online (Sandbox Code Playgroud)

xcode uiactionsheet ios swift

9
推荐指数
1
解决办法
1652
查看次数

unshare()和copy()之间有什么区别?

两个unshare()copy()用于复制数组,但我不能看到的差别.

arrays swift

7
推荐指数
1
解决办法
1043
查看次数

标签 统计

swift ×2

arrays ×1

ios ×1

uiactionsheet ×1

xcode ×1