I'm making an map view were I wanna zoom in automatic on users location, I have done the view controllers coding and are now on app delegate.
AppDelegate.h
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
AppDelegate.m
#import "AppDelegate.h"
#import "WalkingTableViewController.h"
@implementation AppDelegate
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]
WalkingTableViewController *rootVC = [[WalkingTableViewController alloc] init]
[self.window setRootViewController:rootVC]
[self.window makeKeyAndVisible]
return YES;
}
@end
and I get Expected member name or ';' after declaration specifiers on the line
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]
can someone help me please?
2 Answers
Yep, you need to end with ; each statement. It delimits the end of line.
There are a lot of errors here. As someone else said, it looks like you are mixing Objective-C and Swift concepts and syntax in the same file. .m means objective-C so...
You have a method implementation in your @implementation. @implementation is the class implementation and contains method definitions. Also, you need to add a ; after every line to show the compiler that the statement is finished - like a full stop at the end of the sentence. So you should have:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
WalkingTableViewController *rootVC = [[WalkingTableViewController alloc] init];
[self.window setRootViewController:rootVC];
[self.window makeKeyAndVisible];
return YES;
}
@end
But I don't think you're done with the errors there. I think you should look at the basic tutorials before trying to display a map.