I am starting to learn Objective-C, and am using Xcode, but every time I run the program, a thread is run, and prevents any of the code to work. Can you guys explain how I can deal with this? And educate me on it a little bit? I have written a simple console log to demonstrate my problem. Once again, I am new to Xcode and Objective-C, so I need some basic explanation.
Preventing threads in Xcode
105 Views Asked by Jaden Ranzenberger AtThere are 2 best solutions below

I've highlighted some of the keywords you might have to research before you want to continue
I think you've misunderstood the Xcode IDE. You're code has stopped executing, because the debugger hit a breakpoint.
Hitting a breakpoint usually causes the "Debug navigator" (the panel on the left) to be shown. This panel lists the threads running in your program and the stack trace for each thread.
Your program always has at least one thread. This is called the main thread.
Your program, even without breakpoints, won't do anything. You aren't calling any methods (or functions)(or strictly in Objective-C, "messages"). You have made several fundamental mistakes with this very simple program. You might do better to follow some tutorials rather than just jumping in.
Your issue has nothing to do with threads. There is always a thread called the "main thread." That's normal and required (your code has to run in some context).
The above code doesn't run because you never call your function. In C (which ObjC is a superset of), the
main()
function is run automatically. Yourmain()
function does nothing, and immediately returns, so the program will just exit. You need to call your function if you want it to run.Cocoanetics provides a brief introduction to building a non-trivial command-line app in ObjC.