Reputation: 3
I have a project within a project in xCode. I'm creating a new MyView.h, MyView.m and MyView.xib. When I put the MyView.m and MyView.xib in the outer project I can load the view from the inner project like this:
MyView *myView = [[MyView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
[[[UIApplication sharedApplication] keyWindow] addSubview:myView];
However, when I move the MyView.m and MyView.xib files inside the inner project I get a linking error:
Undefined symbols for architecture armv7: "_OBJC_CLASS_$_MyView", referenced from: ...
I'd like to be able to put MyView.m in the subproject because its ViewController is in the subproject and when it's outside the subproject I get the same linking error when I try to connect IBActions from the MyView to MyView's ViewController.
Any help would be great thanks!
Upvotes: 0
Views: 556
Reputation: 70135
The superproject needs to list the subproject under 'Build Phases' within 'Link Binary with Libraries'. Also, ensure that the MyView.m file is part of the build set of the subproject.
Upvotes: 1