I'm trying to debug a certain method, but my breakpoints in that method never get hit when I'm debugging on a device, but they do get hit when I am debugging with the iOS simulator. The method is part of a library that my app calls, and I feel like that may be a factor. I developed both the app and the library, and I have both the app and the library open in the same Workspace when I'm debugging.
I put one breakpoint in on the line in my app's code that calls the library method, then a second breakpoint on the first line of the library. When I test with the simulator, both are hit. When I test on a device, only the first one is hit, and the second one gets skipped over (the code for the library method still appears to run).
Is there anything special I need to do to be able to step into a library call when I'm debugging on a device that I don't need to do when debugging on the simulator? Or is it impossible to debug inside a library?
I'm sorry if this is a little unclear - I'm trying to describe what I'm doing as well as I can, but it's pretty strange behavior that I haven't seen before, so it's a little hard to describe. If you need anymore information or anything is unclear, please let me know.
EDIT 1: I noticed something that's a little different, not sure if it's connected or not: I don't have a .h file containing the methods in my library. Actually, there is only 1 method in it (which I'll callmyMethod
) that will be called from outside the library (then that method calls the other methods in the library as it needs them). Furthermore, I'm using the TARGET_IPHONE_SIMULATOR
pre-processor trigger to make the call in a slightly different manner depending on if it's running on a device or on the simulator. To make the call into the library, on a button click method in my app I just have
#if TARGET_IPHONE_SIMULATOR
extern void myMethod();
myMethod();
#else
extern void myMethod(const char diretory[], int directoryLength);
const char *dir = [[documents path] UTF8String];
myMethod(dir, [[documents path] length]);
#endif
I have matching #if
blocks in the method in my library to declare it as needed, and to use dir
when it is passed in. This seems to execute just fine. I can tell the code in my library is being called and doing something, it's just not doing what I want it to. Thus the attempts to put in a breakpoint, and the reason for this whole question.
EDIT 2: My library actually contains plain C code, not Objective-C. I put some printf
lines into the library code, and its not being displayed. I'm curious if somehow my app is calling a previous version of my library, instead of calling the one that's open in my workspace. That would be consistent with the "it's just not doing what I want it to" part of my last edit. Would it be possible that the device is trying to run an old version of the library it has saved somehow? I thought that completely removing the app from the device before installing the new version of my app would prevent that, but perhaps I'm mistaken?