Ios &引用;线程1:断点3.5“;错误
我是Swift的初学者,目前正在为一个学校项目开发一个应用程序。当我尝试测试我的应用程序时,它说“构建成功”,但随后突然关闭,并且在ViewController.swift屏幕上有一条绿色的错误线: '线程1:断点3.5' 我在网上搜索了所有可能的答案,但没有找到。有人能帮我吗?谢谢大家! 更新:现在出现一个错误,提示“线程1:EXC\U BAD\U指令(代码=EXC\U I386\U INVOP,子代码=0x0)”。我已经搜索过了,我不知道如何修复这个。。。有人吗 代码如下:Ios &引用;线程1:断点3.5“;错误,ios,swift,xcode,Ios,Swift,Xcode,我是Swift的初学者,目前正在为一个学校项目开发一个应用程序。当我尝试测试我的应用程序时,它说“构建成功”,但随后突然关闭,并且在ViewController.swift屏幕上有一条绿色的错误线: '线程1:断点3.5' 我在网上搜索了所有可能的答案,但没有找到。有人能帮我吗?谢谢大家! 更新:现在出现一个错误,提示“线程1:EXC\U BAD\U指令(代码=EXC\U I386\U INVOP,子代码=0x0)”。我已经搜索过了,我不知道如何修复这个。。。有人吗 代码如下: import U
import UIKit
import AVFoundation
class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate
{
@IBOutlet weak var pickerView: UIPickerView!
var pickerDataSource = ["White", "Red", "Green", "Blue"];
override func viewDidLoad() {
super.viewDidLoad()
self.pickerView.dataSource = self;
self.pickerView.delegate = self;
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerDataSource.count;
}
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return pickerDataSource[row]
}
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
{
if(row == 0)
{
self.view.backgroundColor = UIColor.whiteColor();
}
else if(row == 1)
{
self.view.backgroundColor = UIColor.redColor();
}
else if(row == 2)
{
self.view.backgroundColor = UIColor.greenColor();
}
else
{
self.view.backgroundColor = UIColor.blueColor();
}
};
var audioPlayer = AVAudioPlayer() // This is where the error occurs
@IBAction func PlaySound(sender: UISwipeGestureRecognizer) {
// Set the sound file name & extension
let alertSound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("woosh", ofType: "mp3")!)
do {
// Preperation
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
} catch _ {
}
do {
try AVAudioSession.sharedInstance().setActive(true)
} catch _ {
}
// Play the sound
do {
audioPlayer = try AVAudioPlayer(contentsOfURL: alertSound)
} catch _{
}
audioPlayer.prepareToPlay()
audioPlayer.play()
}
}
首先转到断点导航器,如下面链接的图片(1)所述,然后,您将在应用程序中的某个位置看到断点。单击它,然后只需按键盘上的删除按钮。这将解决您的问题
我有一个tableview,它包含数千行数据,每天添加数百行数据 尽管我刚刚开始使用breakboints导航到我需要的地方,但断点已经设置好了(也许有一天我不小心设置了) 在测试时访问tableview时,我遇到了相同的错误,因为当设置断点时,它会在同一行中创建其他断点。 (在我的tableview上,它仍然可以) 如果您在模拟器或设备上上载新应用程序,并在应用程序未连接到Xcode时访问tableview,则没有问题
您可以禁用这些附加断点,也可以仅禁用已创建的断点,因为即使禁用了断点,您仍然可以通过单击左侧断点导航器中的断点导航到所需的断点。尝试从var audioPlayer=AVAudioPlayer()行中删除制动点。您可能会意外设置。谢谢,但现在模拟器变为空白,错误仍然存在……请告诉我这是否有帮助。如果它不起作用,请确保您的应用程序在“情节提要”中有一个入口点(因为您说simuator变为空白)。如果没有,请转到第一个“ViewController”,转到属性检查器并检查:“Is initial View Controller”谢谢,但我的代码中没有断点,并且第一个屏幕有一个入口点。还有其他解决办法吗?非常感谢。