• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iOS Static Library -> Duplicate Class objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iOS Static Library -> Duplicate Class objects


  • Subject: iOS Static Library -> Duplicate Class objects
  • From: email@hidden
  • Date: Mon, 22 Sep 2014 12:09:11 -0700

Hey Xcode Users,
  I’m trying to create a static library to pull some lower level objects out of my App and in to a common framework, but I’m running in to an issue that is confusing my unit tests. Setup:

  • A static library which contains the class WFRoutines
  • A .app which links against the static library
  • A test target for the .app which links against the static library as well

When I run the tests it looks like there are two instances of the classes provided by my library:

(lldb) p (char *)class_getImageName([WFRoutines class])
(char *) $0 = 0x00007fff5c2de6c0 "/Users/nick/Library/Developer/CoreSimulator/Devices/70F1F59A-4AFC-4326-BD65-86BA64D87151/data/Containers/Bundle/Application/B592876B-DD27-4A68-9BD3-C187C15DB7A0/Wealthfront.app/Wealthfront"
(lldb) p (char *)class_getImageName(aClass)
(char *) $1 = 0x00007fe9db70bb90 "/Users/nick/Source/Builds/Test-iphonesimulator/WealthfrontTests.xctest/WealthfrontTests”


This is only a problem for me because I am trying to create a mock object based on this class, and it appears that this line of code does something completely different from what it does in the debugger:

id mockRoutines = [OCMockObject mockForClass:[WFRoutines class]];

As you can see above the debugger believes [WFRoutines class] lives in the .app, however whats not what actually gets passed to OCMock.

Is there some linker magic I can apply to get these two things to align on the same runtime object? Or does OCMock need to be modified to work its magic on all available class instances?

Thanks much.

Nick
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: iOS Static Library -> Duplicate Class objects
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Linker warnings incorporating debug symbols from prelinked static library
  • Next by Date: Xc6 and disappearing unwind segues
  • Previous by thread: Re: Linker warnings incorporating debug symbols from prelinked static library
  • Next by thread: Re: iOS Static Library -> Duplicate Class objects
  • Index(es):
    • Date
    • Thread