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];
}
Related
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];
I'm trying to integrate the RZLTS push notifications service into a objective-c game app.
While i have followed the exact steps provided by the RZLTS documentation the app crashes when i tap the default inbox button.
Here you have my crash log from Xcode:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RZLTSInboxView setWebViewControllerBluredBGImage:webViewController:]: unrecognized selector sent to instance 0x1701f8900'
I have followed every step of the documentation.
Here is my code for setting up the inbox button in the menuscene.m:
- (void)setButtonInbox {
CGPoint inboxPosition = CGPointMake(POSITION_BUTTON_SOUND_WIDTH_MENUSCENE - 15,
self.frame.size.height - SIZE_BUTTON_MORE_MENUSCENE * 2 - 10);
RZLTSInboxView *inboxView = [[RZLTSInboxView alloc] initWithOrigin:inboxPosition
controller:[UIApplication sharedApplication].keyWindow.rootViewController
andType:InboxTypeICONWhite];
[self.view addSubview:inboxView];
}
Here is my code for setting up the inbox GameViewController.m, ViewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
[RZLTS startInbox:self
appID:RZLTS_APP_ID
developerSubID1:#""
developerSubID2:#""
developerSubID3:#""
firstName:#"first"
lastName:#"last"
email:#"technical#firstlast.com"
gender:BOTH
age:12];
Stack trace:
Stefan, thanks for bringing this up. The team has deployed an update that resolves the issue.
The updated SDK is now available at: http://rzlts.com/sdk/RZLTS_iOS_v2.zip
Sam (from RZLTS)
Today, I upgrade my Xcode to the latest version(Version 5.1 (5B130a)) to support iOS 7.1.
After doing this, I run my project in Xcode as usually. Then app crashes.
I didn't change any code before upgrading the SDK version.
The code is running perfectly in iOS 5.x, 6.x, 7.0.x.
I am simply presenting another view controller in the current view controller.
they are both initialized by storyboard.
While processing presentViewController method, it gets a error message "Thread 1: EXC_BAD_ACCESS (code=2, address=0x60)". I have checked the variables, they are both alive, not a released garbage.
What's the problem with iOS 7.1??
the project is using non-ARC mechanism.
Here is my code:
#property (nonatomic, retain) ArticleViewController *articleView;
....
self.articleView = [[UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:#"ArticleViewController"];
...
[self presentViewController:self.articleView animated:NO completion:^() {
log(#"has shown article page...");
}];
but it works fine if presenting another view by using addSubView function:
[self.view addSubView:self.articleView.view];
I really don't know why this happens.
This happened to my app while presenting a view controller with modalPresentationStyle = UIModalPresentationCustom;
Here's how my code looks like on iOS 7.0:
//Inside my MyPresentedViewController:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[self setupContent];
}
return self;
}
- (void)setupContent
{
//TransitionManager adopts UIViewControllerTransitioningDelegate and UIViewControllerAnimatedTransitioning
TransitionManager *transitionManager = [[TransitionManager alloc] init];
transitionManager.presenting = YES;
self.modalPresentationStyle = UIModalPresentationCustom;
self.transitioningDelegate = transitionManager;
}
However, the above code crashes on iOS 7.1 so I changed the implementation to:
#interface MyPresentedViewController
#property (nonatomic, strong) TransitionManager *transitionManager;
#end
...
//Inside my MyPresentedViewController:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[self setupContent];
}
return self;
}
- (void)setupContent
{
//TransitionManager adopts UIViewControllerTransitioningDelegate and UIViewControllerAnimatedTransitioning
self.transitionManager = [[TransitionManager alloc] init];
_transitionManager.presenting = YES;
self.modalPresentationStyle = UIModalPresentationCustom;
self.transitioningDelegate = _transitionManager;
}
Basically, instead of declaring a transitionManager object inside the setupContent method, I created a private property (strong reference) for it.
Hm the only thing I can think of is ensuring that your articleView property is a strong reference.
#property (nonatomic, strong) ArticleViewController *articleView;
I ran into a similar issue with a picker view. In my case the pickerview was set to nil after the selection handler block, although this caused no issues as recently as last night, it was causing the app to crash this morning. Removing that line fixed the issue, however I have converted this project to ARC in the last month so you may have to find a better way to handle clean up.
This may be completely unrelated to the stated problem or answers but I ran into a similar problem when accessing an NSString on an iPhone 5S. The exact same code runs fine on an iPad and iPad at the same time.
To start out with I think it's important to state that I'm running under ARC, and I have been told repeated not to "release" any objects I instantiate in my functions. I've had problems with this before so I use some of my C# background to set almost all of my local variables to nil (null in C#). Yes, I don't trust MS GC either.
Back to the problem at hand; I have an NSString called 'data'. 'data' is read as a result from another method in a different class. Using NSLog I can see the contents of 'data'. On the next line I convert 'data' to an array to use it in scanf. That still works. On the third line I try to NSLog 'data' again, but then I get the EXC_BAD_ACCESS error. Each time it has a different address. I'm even less comfortable with ARC than I am with the Microsoft Garbage Collector so I wrapped the function in a try..catch..finally. 'data' is now sitting outside of the try..catch..finally. I'm setting 'data' to nil in the finally, which seems to fix the problem.
I know this was a bit long winded, but I would really appreciate it someone could explain why this would happen. I'm expecting to see a lot of these problems to popup all over my code now.
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
I'm trying to tweak the behavior of the default IASKAppSettingsViewController so it can provide custom subviewcontrollers (as for type = PSChildPaneSpecifier) for custom views (type = IASKCustomViewSpecifier).
I've tried to subclass IASKAppSettingsViewController without adding any new functionality to the code.
However when I load up my own subclass the settings view is completely empty - even for a bare subclass. When I switch back to the default IASKAppSettingsViewController everything works again as expected.
I've tried setting breakpoints various places in my subclass and everything seems to be working fine - except that nothing is displayed.
I've tried looking for clues in the documentation, but can't seem to find anything that explains why. The documentation for InAppSettingsKit even states that it's designed for subclassing.
What am I missing here? Any clues are appreciated - or even better a small step-by-step guide for dummies.
Updated with code:
Setting up the flipside view. It works with the standard IASKAppSettingsViewController but fails with my empty derived MyCustomSettingsViewController
- (IBAction)showInfo:(id)sender
{
// Setup navigation controller for settings view
MyCustomSettingsViewController *settings = [[MyCustomSettingsViewController alloc] init];
//IASKAppSettingsViewController *settings = [[IASKAppSettingsViewController alloc] init];
settings.delegate = self;
settings.showDoneButton = YES;
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:settings];
navigation.navigationBar.barStyle = UIBarStyleBlack;
[settings release];
// Display the settings
navigation.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navigation animated:YES];
[navigation release];
}
Try to add this method to your subclass:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
return [super initWithNibName:#"IASKAppSettingsView" bundle:nibBundleOrNil];
}
If you don't do that, the default implementation of IASKAppSettingsViewController kicks in and it tries to find a nib named after your class name, in this case "MyCustomSettingsViewController.nib". This probably doesn't exist.
This happens because the default implementation of -init calls -initWithNibName:nil bundle:nil and nil as the filename means to search for a default nib.
Try setting breakpoint on initialization steps and if you are adding that as a subview/ pushing on navigation controller. Use NSLogs for each method so you can find the issue. If nothing works send me the code (create a demo code using IASKAppSettingsViewController) to recerate the problem then I'll look into the issue.