Expected Member Name or `; ` After Declaration Specifiers

Expected Member Name or `; ` After Declaration Specifiers

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?

5

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.