0

I have a simple project, on my basic ViewController.m i'm trying to move to another UIViewController by doing:

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
...
}

- (void)addAlarmBrick {
NewAlarmViewController *navc = [[NewAlarmViewController alloc] init];
[self presentViewController:navc animated:YES completion:nil];
}

I have the NewAlarmViewController on my project with the .m file listed in the target membership.

This is the full error message:

Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_NewAlarmViewController", referenced from:
 objc-class-ref in ViewController.o ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

what am i doing wrong over here?

EDIT:

Adding the settings for both files:

.m file:

.m

.h file:

enter image description here

4 Answers 4

1

Well, It turns out the error was not adding the following to the relevant file:

@implementation NewAlarmViewController


@end

I don't know why the @implementation must be added, but it must be.

Sign up to request clarification or add additional context in comments.

1 Comment

Can you provide the complete code and file name that pertain to the error? I am having the same issue after coping and pasting from one project to another.
0

Go to All settings, select your project and check for Architecture and compiler for c/c++/obj c under build options as shown in the screenshot.

1 Comment

Thanks for the answer, but i think the problem is else where. im currently running on the simulator and compiling for all architectures
0

It sounds like you might have a library included in your project that is only compiled for ARM, and doesn't provide object code to run on the simulator. Did you include any third party libraries in your project? (Or is NewAlarmViewController from a third party library?)

1 Comment

Hi Duncan, NewAlarmViewController is just an empty .h .m files i added (another uiviewcontroller), not from a third party lib. i'll add a screenshot of the settings of the .h file and the .m one to see if it can be helpful
0

Maybe Xcode messed sth up. Did you already try removing NewAlarmViewController from the project and readding it again? -> Select .h and .m file, press delete, remove reference, and then drag them again into your project.

Also clean the build folder (cmd + alt + shift + k) and rebuild your project.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.