Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit-Tests in a static library (includes patch) #24

Closed
GoogleCodeExporter opened this issue Jul 27, 2015 · 2 comments
Closed

Unit-Tests in a static library (includes patch) #24

GoogleCodeExporter opened this issue Jul 27, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

We are building the Unit-Tests as a static library and link this into test 
project.
The app will crash because GTMIPhoneUnitTestDelegate is not present.

----
2009-05-25 18:59:22.633 RABSQLite[23586:10b] *** Assertion failure in 
UIApplicationMain(), 
/SourceCache/UIKit/UIKit-738/UIApplication.m:1084
2009-05-25 18:59:22.634 RABSQLite[23586:10b] *** Terminating app due to 
uncaught 
exception 'NSInternalInconsistencyException', reason: 'Unable to instantiate 
the UIApplication 
delegate instance. No class named GTMIPhoneUnitTestDelegate is loaded.'
2009-05-25 18:59:22.636 RABSQLite[23586:10b] Stack: (
    2484961451,
    2486152763,
    2484960907,
    2493939445,
    816221235,
    61549,
    8210
)
----

The file is only referenced by name and never used, the linker strips the 
delegate.
When using the delegate inside the main function this problem is solved,

----
int main(int argc, char *argv[]) {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

  // Ensures that the app delegate will be linked correctly.
  [GTMIPhoneUnitTestDelegate description];

  int retVal = UIApplicationMain(argc, argv, nil, @"GTMIPhoneUnitTestDelegate");
  [pool release];
  return retVal;
}

---

This little change will have no negative effects and helps to use the 
Units-Tests as a static 
library.

Max

Original issue reported on code.google.com by mcz...@gmail.com on 25 May 2009 at 5:04

Attachments:

@GoogleCodeExporter
Copy link
Author

The linker doesn't pull over objective c classes/categories, by default, you 
need to use -ObjC when linking in a 
static library of Objective C.  
http://developer.apple.com/qa/qa2006/qa1490.html  Also covered in the man 
pages for gcc.


Original comment by thoma...@gmail.com on 25 May 2009 at 5:10

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

Thank you, that solved the problem.

Original comment by mcz...@gmail.com on 3 Jun 2009 at 6:52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant