My first Xcode build ever But EXC_BAD_ACCESS (code=2, address=0x16e837f30) keeps happening

I Am interested in coding, and built my fist app that is an app that has a picture of Niagara Falls with corner radius of 10, But, every time I start the build, it says: Thread 1: EXC_BAD_ACCESS (code=2, address=0x16b123f20) not sure what to do now.

You'd better show the complete code. Is it SwiftUI ? UIKit ?

The fact that image is of Niagara Falls or a corn field in Kansas does not matter and is useless information.

Don't use the "Comments" feature. Just add a new Reply to the end.

Unfortunately, everyone already assumed you were using SwiftUI. You need to show the actual code.

Ok, yes the code is Swift UI

ContentView.swift // L1 Demo // // Created by Freeman Curtis on 4/7/25. //

import SwiftUI

struct ContentView: View { var body: some View {

    ZStack {
        Color(.black)
            .ignoresSafeArea()
        VStack {
            
            Image("niagrafalls")
                .resizable()
                .cornerRadius(10)
                .aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fit/*@END_MENU_TOKEN@*/)
                .padding(/*@START_MENU_TOKEN@*/.all/*@END_MENU_TOKEN@*/)
            Text("Niagra Falls")
                .foregroundColor(Color.white)
            font(.largeTitle)
                .fontWeight(.semibold)
        }
    }

   
   
}

}

#Preview { ContentView() }

SwiftUICore`outlined retain of SwiftUI._CustomHoverEffectInputs: -> 0x1d42ae940 <+0>: stp x22, x21, [sp, #-0x30]! 0x1d42ae944 <+4>: stp x20, x19, [sp, #0x10] 0x1d42ae948 <+8>: stp x29, x30, [sp, #0x20] 0x1d42ae94c <+12>: add x29, sp, #0x20 0x1d42ae950 <+16>: mov x19, x0 0x1d42ae954 <+20>: ldr x0, [x0] 0x1d42ae958 <+24>: ldr x20, [x19, #0x10] 0x1d42ae95c <+28>: ldp x21, x22, [x19, #0x28] 0x1d42ae960 <+32>: bl 0x1d4b104d4 ; symbol stub for: swift_retain 0x1d42ae964 <+36>: mov x0, x20 0x1d42ae968 <+40>: bl 0x1d4b104d4 ; symbol stub for: swift_retain 0x1d42ae96c <+44>: mov x0, x21 0x1d42ae970 <+48>: bl 0x1d4b10174 ; symbol stub for: swift_bridgeObjectRetain 0x1d42ae974 <+52>: mov x0, x22 0x1d42ae978 <+56>: bl 0x1d4b10174 ; symbol stub for: swift_bridgeObjectRetain 0x1d42ae97c <+60>: mov x0, x19 0x1d42ae980 <+64>: ldp x29, x30, [sp, #0x20] 0x1d42ae984 <+68>: ldp x20, x19, [sp, #0x10] 0x1d42ae988 <+72>: ldp x22, x21, [sp], #0x30 0x1d42ae98c <+76>: ret

Your app is crashing. Unfortunately there's nothing in the code you showed that would cause a crash. You have /*@START_MENU_TOKEN@*/ and /*@END_MENU_TOKEN@*/ tokens in the code listing, but my guess is that's a copy paste error. Your project wouldn't build if those tokens were in your actual code.

Add an exception breakpoint in Xcode. When your app crashes, Xcode will pause your project, showing you the code where the app crashed.

In Xcode choose Debug > Breakpoints > Create Exception Breakpoint to add an exception breakpoint.

In your code example there is no dot before:

font(.largeTitle)

While this is syntactically correct for SwiftUI, it causes problems.

My first Xcode build ever But EXC_BAD_ACCESS (code=2, address=0x16e837f30) keeps happening
 
 
Q