*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 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>.
Corrected questions
The
{}
after the @implementationThirdViewController
is unnecessary.
2022-09-30 21:58
If you have any answers or tips
Popular Tags
python x 4647
android x 1593
java x 1494
javascript x 1427
c x 927
c++ x 878
ruby-on-rails x 696
php x 692
python3 x 685
html x 656
© 2025 OneMinuteCode. All rights reserved.