Reputation: 5640
This is driving me crazy. I've been working on a UIImage category, and I just updated to using Xcode 5.1. The problem is, the category isn't compiled after I make changes to the file and, heres the catch, that's only on 64 bit devices/simulators. I've tried deleting the app from the device, cleaning, cleaning the build folder, deleting the derived products folder, and all the previous at once. Nothing is working! Any suggestions would be greatly appreciated!
So my workaround for this problem was to change the signature of the method. The method had been:
- (UIImage *)imageResizedTo:(CGSize)size scale:(CGFloat)scale
And I changed it to:
- (UIImage *)imageWithSize:(CGSize)size scale:(CGFloat)scale
I added NSLog statements to the method and they would print on 32bit devices and on the 64bit simulator, but not on 64bit devices. I added another category with the same signature and that worked just fine, but for whatever reason I could not get Xcode to recognize changes in the category in question, and only on this one method! Breakpoints didn't work inside the function, but they did in other methods in the same category.
I also looked at the build log and it says its compiling the category for armv7 and armv7s.
Things that didn't fix the problem:
Things that did fix the problem:
I still really want to know what is going on with this. Mostly I just want to know why this would be happening, its very strange!
Upvotes: 1
Views: 2880
Reputation: 2897
Are your source files in a "referenced" folder in XCode? You'll know because the folder will appear in blue instead of yellow. If so, referenced folders in XCode currently (and for a long time) have had a bug where changed content within them don't seem to get noticed unless the HIGHEST level parent blue folder has it's mod-date changed. Here's an example
GrandParent Dir (Yellow/Non-referenced)
|
Parent Dir (Blue)
|
File1.txt
Child Dir (Blue)
|
File2.txt
So in that contrived example, if you touch File1.txt, it won't be noticed unless "Parent Dir" gets touched as well. If you touch File2.txt, it's not enough to touch "Child Dir"...you have to touch "Parent Dir" instead!
You can test this by doing:
touch -cm parent_dir
If that works, then you know this is the problem. A lot of users write a script to do the "touching" that needs to be done and then add that script to Xcode to be run at the right build phase.
Upvotes: 1
Reputation: 10938
I had a similar bug long time ago with previous Xcode versions where changes to code wouldn't get compiled and linked unless I cleaned the target every time.
One work around was to touch main.m
on a script build step to force Xcode into think that there's a change that requires code to be rebuilt and linked.
Upvotes: 1
Reputation: 11039
Go to your target setting > Build Phases > Compile Sources and make sure that implementation file of your category exists in that list. If not, then add it manually by tapping on "+" button.
Upvotes: 2