0

Hi i have followed this github page to add MFSideMenu and its showing following error.

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_MFSideMenuContainerViewController", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is my AppDelegate

- (ViewController *)demoController {
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    ViewController *main = (ViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"home"];

    return  main;
}

- (UINavigationController *)navigationController {
    return [[UINavigationController alloc]
            initWithRootViewController:[self demoController]];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    leftMenuController *leftMenuViewController = [[leftMenuController alloc] init];

    MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
                                                    containerWithCenterViewController:[self navigationController]
                                                    leftMenuViewController:leftMenuViewController
                                                    rightMenuViewController:nil];
    self.window.rootViewController = container;
    [self.window makeKeyAndVisible];
    return YES;
}

enter image description here

Bangalore
  • 1,572
  • 4
  • 20
  • 50
  • chcek your .h and .m are correctly added in the target or not – Anbu.Karthik Jul 28 '16 at 09:10
  • my compile source looks like that attached screenshots – Bangalore Jul 28 '16 at 09:12
  • where is your mfide menu clas – Anbu.Karthik Jul 28 '16 at 09:15
  • try this its work for me UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; SideMenuViewController *leftMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"SideMenu"]; // SideMenuViewController *rightMenuViewController = [[SideMenuViewController alloc] init]; MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController containerWithCenterViewController:[self navigationController] leftMenuViewController:leftMenuViewController rightMenuViewController:nil]; self.window.rootViewController = container; – Birendra Jul 28 '16 at 09:34
  • See http://stackoverflow.com/questions/26036826/apple-mach-o-linker-error-on-xcode-6-0-1 if this can help, might be if you are facing some arch issue. – Suhas Arvind Patil Jul 28 '16 at 10:07

2 Answers2

0

Use this code in AppDelegate.m it works for me in storyboard.

- (ViewController *)demoController {
    return [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
}

- (UINavigationController *)navigationController {
    return [[UINavigationController alloc]
            initWithRootViewController:[self demoController]];
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    MFSideMenuContainerViewController *container = (MFSideMenuContainerViewController *)self.window.rootViewController;
    UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"navigationController"];
    UIViewController *leftSideMenuViewController = [storyboard instantiateViewControllerWithIdentifier:@"leftSideMenuViewController"];
     UIStoryboard *storyboard1 = [UIStoryboard storyboardWithName:@"second" bundle:[NSBundle mainBundle]];
    UIViewController *left = [storyboard1 instantiateViewControllerWithIdentifier:@"rightSideMenuViewController"];

    [container setLeftMenuViewController:leftSideMenuViewController];
    [container setLeftMenuViewController:left];
    [container setCenterViewController:navigationController];

    // Override point for customization after application launch.
    return YES;
}

also take a new view controller in storyboard and mark it as initial view controller and give its class name as well as storyboard id as MFSideMenuContainerViewController.

Bhadresh Mulsaniya
  • 2,610
  • 1
  • 12
  • 25
Sabby
  • 403
  • 3
  • 15
0

In general, this will occur when the code for BoxView is not being compiled into your target correctly.

enter image description here

You need to ensure that the target you're building has its corresponding box checked for your MFSideMenuContainerViewController.m implementation file.

A 'Clean and Build' never hurts, either.

Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154