Reputation: 4764
I copied the following from a tutorial where it did not cause an error into my project where it causes three errors on the line indicated. (The errors don't seem correct as when I try to fix them, other errors occur.) Can anyone suggest what might be problem:
@interface VC ()
NSDictionary(JSONCategories) //MULTIPLE ERRORS THIS LINE including cannot declare variables inside @interface
+(NSDictionary*)dictionaryWithContentsOfJSONURLString:(NSString*)urlAddress;
-(NSData*)toJSON;
@end
Upvotes: 0
Views: 98
Reputation: 11201
I assume you are trying to create a category:
a category interface looks exactly like a normal interface, except the class name is followed by the category name in parentheses.
For example Categories should be declared as:
#import "Car.h"
@interface Car (Maintenance) //Maintainence is a category
- (BOOL)needsOilChange;
- (void)changeOil;
- (void)rotateTires;
- (void)jumpBatteryUsingCar:(Car *)anotherCar;
@end
Upvotes: 3
Reputation: 632
This is an NSDictionary
category; you want:
@interface NSDictionary(JSONCategories)
+(NSDictionary*)dictionaryWithContentsOfJSONURLString:(NSString*)urlAddress;
-(NSData*)toJSON;
@end
Upvotes: 3