Bad_Instruction

func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!  {
        var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Component") as UITableViewCell

        if (cell == nil) {
            cell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: "Component")
        }

        cell.textLabel.text = "Baking Soda"
        cell.detailTextLabel.text = "1/2 cup"

        return cell
    }

修改为
var cell : UITableViewCell?

//variable type is inferred
var cell = tableView.dequeueReusableCellWithIdentifier("CELL") as? UITableViewCell

if !cell {
    cell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: "CELL")
}

//we know that cell is not empty now so we use ! to force unwrapping

cell!.textLabel.text = "Baking Soda"
cell!.detailTextLabel.text = "1/2 cup"

cell!.textLabel.text = "Hello World"

return cell

 

------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: Xcode [789] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 15.2 (22503) Build Info: IDEApplication-22503000000000000~3 (15C500b) Code Type: X86-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2025-03-17 04:12:45.5804 +0800 OS Version: macOS 13.7 (22H123) Report Version: 12 Anonymous UUID: D29F54A8-7282-84CD-7ABF-FA42243B8EFE Time Awake Since Boot: 130 seconds System Integrity Protection: disabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4 Terminating Process: exc handler [789] Kernel Triage: VM - (arg = 0x0) Returned success with no page VM - (arg = 0x0) Returned success with no page VM - (arg = 0x0) Returned success with no page VM - (arg = 0x0) Returned success with no page VM - (arg = 0x0) Returned success with no page Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 CoreRE 0x1568cd2f7 re::mtl::makeDefaultDevice() + 101 1 CoreRE 0x1562d5ea3 re::RenderManager::init(re::FrameManager*, re::RenderManagerConfiguration const&, re::JobService*, re::ProfilerManager*, re::ColorManager*, re::VFXManager*, re::DepthMitigationService*, re::ImportGraphicsResources*, bool) + 191 2 CoreRE 0x1565f6ca7 re::Engine::init(re::EngineConfiguration const&) + 9249 3 CoreRE 0x156635c9f REEngineInitWithConfiguration + 13 4 RealityFoundation 0x1523b6aec __Engine.init(configuration:) + 412 5 Preview
03-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值