0

I asked a question here yesterday about HOWTO debug in a framework.

I have one networkLib, and a usingLibDemo project.

The answers suggest me to pull the networkLib into usingLibDemo so that I can debug in the source code.

Now I've tried :

  1. Output a framework from networkLib, and use the framework in usingLibDemo. It works.
  2. Copy all the source code of networkLib into usingLibDemo, it works again.
  3. Drag the networkLib project into usingLibDemo project, set the Header Search Paths in the Build Settings and set the Target Dependencies in the Build Phases. It fails.

In #3 situation, the project is build successfully when using headers only. For example, I just use the protocol:

@interface ViewController : UIViewController <LoginUIDelegate>

@property (retain, nonatomic) IBOutlet UITextField *usernameText;
@property (retain, nonatomic) IBOutlet UITextField *passwordText;
@property (retain, nonatomic) IBOutlet UIButton *loginButton;

- (IBAction)loginBtnDidClick:(id)sender;

@end

But when I use the code in the .m file :

[[LoginBizLogic sharedInstance] loginWithUsername:username password:password tokenLogin:NO uiDelegate:self];

Build failed like below :

enter image description here

The @interface of LoginBizLogic, as well as LoginUIDelegate, is defined in LoginBizLogic.h file, but the @implementation is in the 'LoginBizLogic.m' file.

I think the LoginBizLogic is not linked properly, and the same with other Class, but I can not figure out where the problem is, or where to config.

Many thanks.

Community
  • 1
  • 1
Jason Lee
  • 3,200
  • 1
  • 34
  • 71
  • 1
    see my question and try the accepted answer, that worked well for me. [ERROR: Undefined symbols for architecture i386](http://stackoverflow.com/questions/14157632/error-undefined-symbols-for-architecture-i386) – DD_ Mar 28 '13 at 05:34

2 Answers2

2

Read Answer From This Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.

In Your case:

TargetSettings -> Build Phases -> Compile Sources -> add your .m file  ->Build and Run 
Community
  • 1
  • 1
iPatel
  • 46,010
  • 16
  • 115
  • 137
  • 1
    @iPatel thank you for your valuable help but please make sure don't post duplicate answers here, instead just link that question, FYI duplicate answers will be deleted by community, Hope you got me! – swiftBoy Mar 28 '13 at 07:44
1

Thank you, @iPatel

From your answer I know where the problem is:

enter image description here

and how to explicitly compile imported files, but networkLib has too many files to select:

enter image description here

It's annoying to select 135 items, and I have set the dependency:

enter image description here

enter image description here

So I think before compiling usingLibDemo, networkLib has been compiled.

It is compiled, why symbols not found? -------> Not linked! I import the library for linking :

enter image description here

That's it! Thanks again.

Jason Lee
  • 3,200
  • 1
  • 34
  • 71
  • 1
    please! don't forget to accept the answer whether solution posted by other or self. Once you accept the answer people come to know this problem has been solved and which is the solution,because that makes better stack overflow and your repo too. – swiftBoy Mar 28 '13 at 07:48
  • I had the same problem and Linking the binary solved the problem. Thanks – Haroun SMIDA Oct 23 '19 at 08:55