iOS AMSlideMenu Receiver () has no segue w

2019-02-14 23:07发布

问题:

I wanted to use the library AMSlideMenu to have a navigation drawer. I saw the YT Tutorial to make my own navigation drawer with it.

The problem, it's, I wanted to use ONLY the left menu, and so i've this error, because it doesn't found the rightMenu...

How can I solve it ?

thx,

回答1:

I fixed this by double checking that my Segue Class was set correctly. Click the segue link between your table view and your segue views and ensure you have set the classes to 'AMSlideMenuContentSegue' and the correct identifiers ('firstSegue', 'secondSegue'):

Prior to this link, the MainVC (or equivalent) view segue to the table view of links for the menu should have it's class set to 'AMSlideMenuLeftMenuSegue' and it's identifier set to 'leftMenu;

Additionally, if the above all checks out in your code, then this resolved issue might have the solution you're after: https://github.com/SocialObjects-Software/AMSlideMenu/issues/21



回答2:

I had same problem. If AMSlideMenu catch an exception when trying to create LeftMenu then try to create RightMenu (i don't understand why, but is true). In my case the left menu "firstSegue" point to a 'wrong view', because it is a simple view controller not a navigation controller. I change the view controller to a navigation controller(that point to my original view controller), fixed it. sry for my english...



回答3:

Copy the AMSlideMenuWithoutStoryboard-Prefix.pch file settings to the PCH file from your project.



回答4:

I just fixed it on my project. I hope the solution would be valid for you guys:

Just add a new .pch file, then go to the Build Settings tab, search for "prefix header" and set path to that.

On your PCH file add this #define AMSlideMenuWithoutStoryboards

I hope it can work without problem.



回答5:

AMSlideMenu creator suggest to add:

#define AMSlideMenuWithoutStoryboards

on project's pch.

I've tried this solution and definitely does not work.
As explained in this post, if you install AMSlideMenu with cocoapod, you have to define AMSlideMenuWithoutStoryboardsin .pch file of pod project.

This is a workaround is evil: each time you'll run pod update you shall remember to manually add that line on AMSlideMenu .pch file.

My solution is add run script on project build phases that, in my case, is:

output=$(find .. -name "AMSlideMenu-prefix.pch")
source=${SRCROOT}/${PROJECT_NAME}/amSlideMenuConfig
log=${SRCROOT}/${PROJECT_NAME}/MyProject.log

echo -e "Configuring AMSlideMenu" > ${log}
echo -e "Reading configuration from: " "${source}" "\n" >> ${log}
echo "$(cat ${source})" > "${output}"
echo -e "Project configured.    " >> ${log}

Where amSlideMenuConfig contains old definitions:

#import <Availability.h>

#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#define AMSlideMenuWithoutStoryboards

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

This script is executed each time you build project: in order to improve optimize the process, you can add any check you need inside script.