*You answered the question "Expected'; 'at end of declaration list error cannot be resolved" which I posted before, and after correcting it, a new error occurred, so I edited the question. 内容
Objective-C cannot resolve the Collection element of type 'void' is not an Objective-Cobject error.
This is NSAray_lines=@[@"A", @"B", @"C", nil ]
I would appreciate it if you could tell me the cause.
#import "ThirdViewController.h"
@ interfaceThirdViewController()
@end
constintChangeCheckCell=1;
NSMutableArray* checkboxArray;
NSArray*_lines=@[@"A", @"B", @"C", nil ];
@implementationThirdViewController{
}
- (void) viewDidLoad{
superviewDidLoad;
The underlying problem is
NSArray*_lines=@[@"A", @"B", @"C", nil ];
The last semicolon of is missing.However, the location of the declaration and initialization of the variables is not good, so the code you want to write is probably as follows:
#import "ThirdViewController.h"
@ interfaceThirdViewController()
@end
constintChangeCheckCell=1;
NSMutableArray* checkboxArray;
NSArray*_lines=@[@"A", @"B", @"C", nil ];
@implementation ThirdViewController
- (void) viewDidLoad{
superviewDidLoad;
You cannot declare variables that are not inside a function between @implementation
and @end
.
ThirdViewController
If you want to declare a variable that is visible only in ThirdViewController.m
that is not a member of the class, you should write it outside @implementation
.
Also, if Corrected questions The checkboxArray
and _lines
are members of the class, the variable declaration should be done between @interface
and @end
in ThirdViewController.h
to initialize the variable with viewDidLoad>.
{}
after the @implementationThirdViewController
is unnecessary.
© 2025 OneMinuteCode. All rights reserved.