Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSwapnil Kapse
1,162 PointsIssue while trying this tutorial related to categories in xcode6
Hi
I am trying out this tutorial related to categories in xcode6. I am facing below issues
- If #import<Cocoa/Cocoa.h> is not present in main.h, I get error for sentence NSLog(@"Initial Capitalized Letters are %@", [letters capitalizedString]); for letters capitalizedString
Error is 'No visible @interface for 'NSArray' declares the selector capitalizedString.' How to resolve this? Has anyone observed this error?
- If #import<Cocoa/Cocoa.h> is added in main.h, I get error 'Cocoa/Cocoa.h file not found'. From where can I add this file.
Note : xcode6 new file type selection options are different than shown in tutorials. I am using File > New > IOS > Source > Objective C File > File Type : Category and Class : NSArray
Please help resolving these issues.
3 Answers
Louis DeRienzo
2,378 PointsI had this same exact problem. Most likely it's because the video is outdated for the new Xcode.
If this helps, go to create a new file, and instead of opening a Cocoa class file, open an empty objective-c file and make sure the file type is category. The rest is the same with the video.
At least that was the problem that I had, followed along with going to Cocoa class when apple moved the category file into the objective-c file.
Judy Tsai
6,376 PointsJust checking, do you have both .h files imported?
#import <Cocoa/Cocoa.h>
#import "NSArray+new_mahem.h"
Swapnil Kapse
1,162 PointsYes. Its added already.
Judy Tsai
6,376 PointscapitalizedStrings is the function associated with NSString. The method declared in mahem file should be capitalizeString, not capitalizedString.
Try changing it to
NSLog(@"Initial Capitalized Letters are %@", [letters capitalizeStrings]);
See if that helps.