'ld: entry point (_main) undefined. for architecture arm64

not sure what to do. i keep getting this message "ld: entry point (_main) undefined. for architecture arm64" I am unsure if it has to do with my process but I have a Mac M1 chip for my laptop. any help is appreciated.



Solution 1:[1]

Add this to your project and target.

enter image description here

Solution 2:[2]

It can happen when you unlink your AppDelegate from your app's target (it happened to me due to some bad conflict resolution). It also can mean that for some other reason @main attribute disappeared from your AppDelegate's class.

Solution 3:[3]

I hit this error while Archiving.

After some trail-and-error I discovered that this terribly confusing error was actually caused by my deleting Preview Content/Preview.xcassets

Restoring the folder + catalogue (and correcting the reference in Build Settings) resolved the issue for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shabnam Siddiqui
Solution 2 Maciek Czarnik
Solution 3 emehex