I am getting the "Subscripted value is neither array nor pointer" error on a boolean made from another class that gets allocated in another. After looking up lots of reasons for getting this error, I'm not sure how I can relate it to mine. I'm using the Cocos2D library, but I don't think it has to do with that.
In another class this is my interface with a property. Just calling it ClassA for this example:
#import <Foundation/Foundation.h>
@interface ClassA : NSObject {
@public
@public
BOOL _deactivateLabelToggle;
}
@property(nonatomic, assign) BOOL deactivateLabelToggle;
.m
#import "ClassA.h"
@implementation ClassA
@synthesize deactivateLabelToggle = _deactivateLabelToggle;
BOOL _deactivateLabelToggle[100];
-(id) init{
self = [super init];
if (!self) {
return nil;
}
return self;
}
- (void) dealloc{
[super dealloc];
}
@end
My main class header
#import "ClassA.h"
@class ClassA;
@interface MainClass : CCLayer {
ClassA *classA;
}
@property(nonatomic, retain) ClassA *classA;
@end
MainClass.m
#import "MainClass.h"
@implementation MainClass
@synthesize classA;
-(id) init {
if( (self=[super init] )) {
classA = [[ClassA alloc] init];
classA.deactivateLabelToggle[i] = 0; // <---- Error here
}
return self;
}