Sometimes your Xcode project file gets messed up, especially if you have an old project and first created it with an older version of Xcode/iPhone SDK.
What you need to do is open up the project file in a text editor, search for the 'long string' from your error and manually erase that line.
In fact, you should just go ahead and erase any line that points to any provisioning profiles. Then reopen the project in Xcode, go to the settings and reselect your new profile. This clears up issues like that most of the time.
The lines that point to the provisioning profiles will look like this:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
Do you have (non-category declaration):
@interface ClassB
@end
declared anywhere, usually in ClassB.h
?
Or a forward declaration:
@class ClassB
in ClassA.h
?
Try this for your ClassA.h
:
//ClassA.h
@class ClassB
@interface ClassB (Category)
+ (id)classMethod
@end
Then put #import "ClassB.h"
in ClassA.m
.
You should put this in ClassA.h
:
@interface ClassA (Category) {
}
@end
And then the:
@implementation ClassA (Category)
in ClassA.m
above the non-category @implementation ClassA
.
Personally, I create seperate files for categories. For example, this is in UIView-Extended.h:
@interface UIView (UIView_Extended)
enum {
UIViewAutoresizingHorizontal = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleRightMargin),
UIViewAutoresizingVertical = (UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleBottomMargin),
UIViewAutoresizingAll = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleBottomMargin)
};
typedef NSUInteger UIViewAutoresizing;
- (UIView *)findFirstResponder;
- (UIView *)setFirstResponder:(NSUInteger)viewTag;
- (IBAction)dismissKeyboard:(id)sender;
- (IBAction)nextPrevious:(id)sender;
@end
And then in UIView-Extended.m
:
#import "UIView-Extended.h"
@implementation UIView (UIView_Extended)
- (UIView *)findFirstResponder {
if ([self isFirstResponder]) {
return self;
}
for (UIView *subview in [self subviews]) {
UIView *firstResponder = [subview findFirstResponder];
if (firstResponder) {
return firstResponder;
}
}
return nil;
}
- (UIView *)setFirstResponder:(NSUInteger)viewTag {
if (self.tag == viewTag) {
[self becomeFirstResponder];
return self;
}
for (UIView *subview in self.subviews) {
UIView *v = [subview setFirstResponder:viewTag];
if (v) {
return v;
}
}
return nil;
}
- (IBAction)dismissKeyboard:(id)sender {
[[self findFirstResponder] resignFirstResponder];
}
- (IBAction)nextPrevious:(id)sender {
UIView *responder = [self findFirstResponder];
if (!responder) return;
NSInteger newTag;
NSInteger tagMod = 1;
if (sender) {
tagMod = (((UISegmentedControl *)sender).selectedSegmentIndex ? 1 : -1);
}
UIView *v = [self viewWithTag:responder.tag + tagMod];
if ([v isKindOfClass:[UITextField class]] || [v isKindOfClass:[UITextView class]]) {
newTag = responder.tag + tagMod;
[self setFirstResponder:newTag];
} else {
// do something else... but what??
}
}
@end
Then, in my Prefix file (Project-Prefix.pch
):
#import "UIView-Extended.h"
Best Answer
The problem is that you have an infinite loop in your #imports. The solution: all #imports go in the implementation file and all classes needed are declared in the .h files.