SASlideMenu has no segue with identifier null - ios

I am using https://github.com/stefanoa/SASlideMenu to implement a left slide menu in my application. I've followed the tutorial and connected everything as the sample project has. But I keep getting this error:
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier '(null)''
The error comes form the SASlideMenuLeftMenuSegue
[leftMenu didMoveToParentViewController:rootViewController];
NSString* initiaSegueId = [rootViewController.leftMenu.slideMenuDataSource initialSegueId];
NSLog(#"initialSegueID->%#",initiaSegueId);
[leftMenu performSegueWithIdentifier:initiaSegueId sender:leftMenu];

I was having the same problem. I solved it by adding:
-(id) initWithCoder:(NSCoder *)aDecoder{
if (self = [super initWithCoder:aDecoder]) {
// Assign self to the slideMenuDataSource because self will implement SASlideMenuDatSource
self.slideMenuDataSource = self;
self.slideMenuDelegate = self;
}
return self;
}
I initially left this out and was getting the crash. Add this to assign the delegate and datasource to solve it.

I've figured it. It happened that I was editing a Storyboard and the changes weren't saved. This was happening because there were 2 different storyboards because of the localization :/ I didn't realize that. That was why I set the segue with that ID and kept getting that error

Related

'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:

I am beginner doing objective C.
I was trying to understand/copy Jitsi code.
In their AppDelegate.m, they have done something like this
ViewController *rootController = (ViewController *)self.window.rootViewController;
[jitsiMeet showSplashScreen:rootController.view];
return YES;
line: https://github.com/jitsi/jitsi-meet/blob/master/ios/app/src/AppDelegate.m#L59
Here showSplashScreen is this
- (void)showSplashScreen:(UIView*)rootView {
[RNSplashScreen showSplash:#"LaunchScreen" inRootView:rootView];
}
Where RNSplashScreen showSplash method is this
+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView {
if (!loadingView) {
loadingView = [[[NSBundle mainBundle] loadNibNamed:splashScreen owner:self options:nil] objectAtIndex:0];
CGRect frame = rootView.frame;
frame.origin = CGPointMake(0, 0);
loadingView.frame = frame;
}
waiting = false;
[rootView addSubview:loadingView];
}
line: https://github.com/crazycodeboy/react-native-splash-screen/blob/master/ios/RNSplashScreen.m
Now, I did the same but they used .xib file and I was using storyboard.
Like in my info.plist I have this
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
So blindly copying the code, I did something like this in my project using storyboard but I am getting following error
someMobileMobile[73326:1790521] *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: 'Could not load
NIB in bundle: 'NSBundle
</Users/xyz/Library/Developer/CoreSimulator/Devices/1B60169F-B19B-459F-85C6-E80537C7B18B/data/Containers/Bundle/Application/5CDFA673-1009-49C3-8F7D-7F1A0C8E7F57/someMobileMobile.app>
(loaded)' with name 'LaunchScreen''
Primary Question
Is this error because I am using storyboard instead of xib?
Secondary Question
Can someone please also explain the code snippet pasted above? and lastly, what does (ViewController *) mean
see the difference of the following 3 ways to instantiate something from your Interface Builder work.
[NSStoryboard.mainStoryboard instantiateControllerWithIdentifier:#"youridentifier"];
NSStoryboard *launchScreen = [NSStoryboard storyboardWithName:#"LaunchScreen" bundle:NSBundle.mainBundle];
[launchScreen instantiateControllerWithIdentifier:#"yourIdentifier"];
[NSBundle.mainBundle loadNibNamed:#"SomeXibOrNib" owner:self topLevelObjects:nil];
In your example you try to load via the NSNib method but you obviously meant the NSStoryboard LaunchScreen.storyboard
With your code it is in fact looking for a Nib called "LaunchScreen.xib" or "LaunchScreen.nib" which the error tells you does not exist.
and your 2nd Question.
If your info.plist contains a proper entry for a MainStoryboard and this Storyboard is setup correctly, it will instantiate your Window with a ViewController as Root that was given.
Which means after the "Main" Window is loaded from that Storyboard you can access its rootViewController property asking for its ViewController in charge.
UI/NSViewControllers come usually with a corresponding NS/UIView for free, but because subclassed Controllers may be different a typecast is needed to get rid of the warning telling you that. So to make sure the variable rootController will hold a pointer to an object of ViewController that has a property view it is typecasted.
Which works because the given RootViewController is of type "ViewController" and very likely a subclass of NS/UIViewController.
Typecasts also express you know the inheritance works because you guarantee that a view property does exist at runtime.
PS:it is always a bit confusing when chosen classnames are very simplified without any further indication which one is meant. ViewController could have been named "ANViewController" which will help you in larger projects when you have a lot different ViewControllers.

iOS : initWithCoder fail : 'Exercised class for selector implementation needs to be pushed'

I have an UIImageView subclassed as CLImageView that has been implemented with lazy load.
Just ago I have encountered this error message :
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Exercised class for selector implementation needs to be pushed'
*** First throw call stack:
at line : if(self=[super initWithCoder:aDecoder]) {
- (instancetype)initWithCoder:(NSCoder *)aDecoder{
if(self=[super initWithCoder:aDecoder]){
self.placeholderImage = nil;
self.delegate = nil;
self.cacheEnabled = NO;
self.prettyLoad = NO;
}return self;
}
I have never seen this error until 5 years of iOS programming, and I could not find any information on this kind of message here.
If anybody can drop me some ideas would be grateful.
If you need more information just leave a comment or reply.
Thank you so much.

Crash in self.view after constructor on iOS 8.1 and 8.2

I'm trying to do a simple SpriteKit action - adding a view to a scene:
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:#"LevelsEditorStoryboard" bundle:[NSBundle mainBundle]];
self.levelsEditor = [mainStoryboard instantiateViewControllerWithIdentifier:#"LevelsEditorId"];
[self.scene.view addSubview:self.levelsEditor.view];
On iOS 8.0 and 8.3 is working fine and on iOS 8.1 and 8.2 I'm getting the following error:
SPBingo[75304:80943666] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextSelectionView name]: unrecognized selector sent to instance
I realised that this crash caused by the UITextField.
Once I'm getting rid of it, replacing the UITextField with some UITextView ( not ideal but whatever) The view is loading but when I try to click on a UITextView it crashed. The other Input views work (switches, dataPicker, tableView etc.)
After a deep dive into it I figured out that the problem occur in the contractor already. When I put breakpoint on the the second line in the following code :
-(instancetype) initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if(self)
{
}
return self;
}
and try to print "self.view" I'm getting the following error:
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3)..
The process has been returned to the state before expression evaluation.
ODD!
You cannot access the view until after the "viewDidLoad:" method signature is called, otherwise it attempts to create the view before all the prerequisites are in place.
Make sure to call self.view from "viewDidLoad:", "viewWillAppear:" or "viewDidAppear:" when it has properly been setup.
So.. it is an internal bug by Apple which create in 8.1 and fixed in 8.3.
The solution is avoid using the UITextView contractor "initWithFrame" and use the following one:
UITextView *textView = [[UITextView alloc] initWithFrame: frame textContainer: textContainer];

Set the topViewController before loading ECSlidingViewController

I am following this tutorial to make a Sliding app.
I have added the ECSlidingViewController in my project.
I have performed only few steps from the tutorial then I have encountered the error.
I have written nothing in code except the code from tutorial i.e.
- (void)viewDidLoad
{
[super viewDidLoad];
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"ToDoView"];
}
When I run the app my app crashes and showing me this error:
Terminating app due to uncaught exception 'Missing topViewController',
reason: 'Set the topViewController before loading ECSlidingViewController'
I searched google and Tried many ways some of them are form the links:
First Link
Second Link
I am not able to find any genuine solution.
It's Strange when i Interchange the lines in ViewDidLoad it works file:
- (void)viewDidLoad
{
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"ToDoView"];
[super viewDidLoad];
}

SIGABRT Error on my TabBarController when selecting the second tab

So I am making a card playing game where I have a UITabBarController and I have two tabs. Now the first tab is working perfectly fine but when I click on the other tab I receive this error
"Thread 1: signal SIGABRT" and on the debugger panel I have "argc = (int 1)" and argv = (char **) 0xbffff38c. I am using a story board for this project.
Below is my View Controller for the tab that throws me the error above.
If you need anymore code let me know but I was thinking it was probably a problem with my View since it won't even load.
#import "GameResultsViewController.h"
#import "GameResult.h"
#interface GameResultsViewController ()
#property (weak, nonatomic) IBOutlet UITextView *textResults;
#end
#implementation GameResultsViewController
- (void) updateUI
{
NSString* displayText = #"";
for (GameResult* gameResult in [GameResult allGameResults])
{
displayText = [displayText stringByAppendingFormat:#"Score: %d %# %0g\n",gameResult.score, gameResult.end, round(gameResult.duration)];
}
self.textResults.text = displayText;
}
- (void) setup
{
}
- (void) awakeFromNib
{
[self setup];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
[self setup];
return self;
}
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self updateUI];
}
#end
this was also in the debugger window
2013-07-25 20:38:46.360 Matchismo[1119:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<GameResultsViewController 0x758cce0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key display.'
*** First throw call stack:
(0x1c9b012 0x10d8e7e 0x1d23fb1 0xb84e41 0xb065f8 0xb060e7 0xb30b58 0x23a019 0x10ec663 0x1c9645a 0x238b1c 0xfd7e7 0xfddc8 0xfdff8 0xfe232 0x11f8c9 0x11f704 0x11dbda 0x11da5c 0x11f647 0x10ec705 0x202c0 0x20258 0x242ff4 0x10ec705 0x202c0 0x20258 0xe1021 0xe157f 0xe1056 0x246af9 0x10ec705 0x202c0 0x20258 0xe1021 0xe157f 0xe06e8 0x4fcef 0x4ff02 0x2dd4a 0x1f698 0x1bf6df9 0x1bf6ad0 0x1c10bf5 0x1c10962 0x1c41bb6 0x1c40f44 0x1c40e1b 0x1bf57e3 0x1bf5668 0x1cffc 0x297d 0x28a5)
libc++abi.dylib: terminate called throwing an exception
(lldb)
This part of your console log tells you what's going on:
[<GameResultsViewController 0x758cce0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key display.'
*** First throw call stack:
At some point in your app, an object is trying to set the 'display' property on an object of the GameResultsViewController class - but that class does not have this property.
It might be a stray outlet in Interface Builder if you've renamed a property - the old connection still exists in Interface Builder, so when the NIB loads the runtime tries to connect the outlet and fails with this error. Or you have a line of code somewhere where you have something like gameResultsViewController.display = ... and the display property is incorrect (either incorrectly named, or you haven't added to the GameResultsViewController class yet).
My 5c is on a renamed property being left in Interface Builder. Check out the outlet view on your ViewController to see if there's anything grayed out - usually indicates a broken property. Example here I renamed the button property to myButton - so you see the unconnected myButton property, and the warning on the button property.

Resources