I am facing some kind of issue in my when I compile my code with xcode 7.
Here is my code:
UIViewController *vcSomeObj = [self.storyboard instantiateViewControllerWithIdentifier:#"vcSOmeClass"];
vcSomeObj.channelID = detailOfUserTable.ID;
[self.navigationController setViewControllers:#[vcSomeObj] animated:NO];
This is working fine when I compile and run my code from xcode6.4.
This thing hang my application. And when I goes to any app and come agian to my app it will take to main controller and after sometime app crashes.
I can't find anything in debug.
In storyboard file We need to select English check box also otherwise application will hang an crash.
In my opinion.you set the current navigation's viewcontroller.what's happen to current viewController in navigation stack when you in current viewController,so ,I guess you can do like this
[self.navigationController setViewControllers:#[vcSomeObj,self] animated:NO];
Related
i am making a very complicated app with a lot of classes.
my app worked great and i worked on it for the last month.
the last time i worked on it i added a function and it worked great, i saved the app and ran it a few times since and it worked. the last time i turned my computer on, it prompted me that an update for xcode is available. i updated it, and since then every time i run my app it runs with no errors but on ios simulator it shows a black screen. what can i do? i worked really hard on that app. thanks for the help in advance.
There's few issues that could happened, withou detailed description of this issue, you can try following solutions:
reset simulator
check if your initial controller is set up in storyboard(select controller and press attribute inspector, select is initial view controller):
if you're setting initial view controller programmatically, check if that controller is not nil in app delegate
another tip - try to use UI debugger, that helps a lot:
Any debug messages in the Xcode output? That usually will give a clue.
One thing I can think of, is that in your
- (void) applicationDidFinishLaunching:(UIApplication*)application
delegate, try setting the window's root view controller to your view controller. Example:
[window setRootViewController:viewController];
[window makeKeyAndVisible];
Again, the Xcode debug output will confirm if this is indeed the case though.
I am currently developing an iOS application for both iPhone and iPad. I'm trying to show a NavigationController to make a module that shows files. In an iPhone it works just fine, but I can´t get it to work in iPad.
I'm getting the following error:
'Storyboard (<UIStoryboard: 0x919b200>) doesn't contain a view controller with identifier 'FilesNavigation''
and this is the code:
case 10: // Files
{
UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:#"FilesNavigation"];
FilesViewController *filesViewController = [storyboard instantiateViewControllerWithIdentifier:#"Files"];
[navigationController pushViewController:filesViewController animated:YES];
self.slidingViewController.topViewController = navigationController;
break;
}
And in my storyboard I have already set the Storyboard ID for the navigation controller.
>##Custom Class
>Class: UINavigationController
>##Identity
>Storyboard ID: FilesNavigation
I used this code for another case on the switch/case block for other module and it works for iPad too, its the first time that I have this error.
I figured it out, the problem was that the Storyboard wasn't updating in the device.
Uninstall the app from the simulator/iPhone/iPad
Product > Clean
Build & Run
As stated in #T0m_Twt's answer in this question
In the right pane, in the identity inspector section give a storyboard Id to your Navigation Controller.
I took a screenshot for you
Here's another case:
There are two localized storyboards. Only one of them has the view controller you want.
By chance, do you have a storyboard for iPhone and a different one for iPad? If you do, then the iPad one might not have a storyboard with that identifier. Also when running on an iPad, set a break point in your code and verify what your "storyboard" object is.
I use a category on UIStoryboard that will give me the storyboards for each platform.
I can use [UIStoryboard storyboardHome] and that will determine if it needs iPad or iPhone specific and return that to me. I also ensure my storyboards follow proper naming. So I would have Home_iPad and Home_iPhone.
TL;DR - clear everything and remove old version of the app as well, if there's any.
It may sound crazy, but suppose that if you have changed target name which changed bundle name as well, you might have both the old and new version of the app installed in the simulator / device, and this might cause trouble for the UIStoryboard instance failed to instantiate some view controllers, which might eventually cause the trouble described in the question. To solve it, you need to remove all related apps or simply reset the simulator / device.
Still new and learning so please please bear with me. I have two issues regarding this topic. A little background. I have developed a app that has 5 tab bar items. One tabBarItems' view (the home view) has 5 buttons. One of these buttons loads the RootViewController for the open source [FGallery Slideshow Project] (https://github.com/gdavis/FGallery-iPhone) created by Grant Davis. I incorporated a good portion of the features into my app. Using a UIButton in HomeViewController I push to the RootViewController which is edited to suite my needs. I made some additions and omissions.
ISSUE 1: MOST IMPORTANT
I have a problem with the app crashing on the Go Back Button (Home if your in the initial load of the RootViewController).After the RootViewController loads I can step through the gallery functions just fine. If I click back (to the previous view) it will crash on Going back to HomeViewController with the following error in the app delegate:
"Thread 1: EXC_BAD_ACCESS(code=11, address=0x10)"
it appears on this line of code:
#import "MyAppleAppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MyAppleAppDelegate class]));
}
}
ARC is omitted on the classes that make up the Gallery. The rest of the app uses ARC.
Target build is 7.1. Everything works fine if loaded using 6.1 by programmatically targeting Legacy UI but only in the simulator. I have not had a chance to test it on a device running iOS 6.1 only 7.1. Of course with all of apples recent changes It is best to just build for 7.1. Sad thing is when I started this app 6.1 was the standard :(
HomeViewController UIButton to gallery:
-(IBAction)showGallery:(id)sender
{
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:#"gallery"];
[self.navigationController pushViewController:controller animated:YES];
}
ISSUE 2: NOT AS IMPORTANT I AM SURE I CAN FIGURE THIS ONE OUT BUT..
In the view that shows the toolbar which controls which image is showing. The tool bar is hidden under the TabBar along with half of the caption container. In iOS 6; No problem, they stack on top of each other the way they are so-pose to.
Thanks in advance for any help I realize this question might be a bit much.
I fixed my current main issue by converting the FGallery to use ARC.
I have been trying to present a view controller on my app but whenever I present it, it gives me an empty view. I have searched a lot on the internet and the StackOverFlow but none of the solutions are working for me. Here is my code:
In my viewWillAppear, I am calling the method:
[self performSelector:#selector(presentConfirmationView) withObject:nil afterDelay:0.4];
and here is the definition to the presentConfirmationView:
ConfirmRegistrationViewController *confirmationRegistrationController = [[ConfirmRegistrationViewController alloc] initWithNibName:#"ConfirmRegistrationViewController" bundle:Nil];
[self presentViewController:confirmationRegistrationController animated:YES completion:NULL];
Any idea why this might be happening? BTW, I am using Xcode 5.0.2.
I have tried to shift the code to viewDidAppear as well but to no avail.
When this happened to me (Xcode 6.4, iOS 8.4 simulator), the fix was to delete the app in the simulator and also delete my Build folder (I guess a Product->Clean command might also have worked).
I have an issue with upgrading to Xcode5. Before I even set about changing anything in my project I thought I would build and run it with the IOS7 3.5inch Simulator. There are two major issues and this is the main one that I cannot figure out. I have identified a line of code that has always worked perfectly until now - now whenever it runs my app crashes with an EXC_BAD_ACCESS
I've traced it to a single line of code which is my popToRoot - basically at the end of filling out a form and saving it I want to reset the view to defaults which is what I have successfully used this line of code for until now.
The code looks like this:
[self.navigationController popToRootViewControllerAnimated:NO];
With some NSLog'ing in it looks like this:
NSLog(#" self.navCon is %#", self.navigationController);
NSArray *myControllers = self.navigationController.viewControllers;
NSLog(#"myControllers Content is %#", myControllers);
NSLog(#"myControllers Count is %i", myControllers.count);
[self.navigationController popToRootViewControllerAnimated:NO];
And my log out put looks like this:
2013-11-10 00:21:32.480 trainForTri copy[9552:a0b] self.navCon is <UINavigationController: 0xb5bf580>
2013-11-10 00:21:32.481 trainForTri copy[9552:a0b] myControllers Content is (
"<SGK_T4T_01SecondViewController: 0xbaeac00>",
"<AddSessionSessTypePicker: 0xb5e51e0>",
"<SGK_T4T_01SecondViewController: 0xbb5fa00>"
)
I have noticed that the 1st and 3rd viewControllers in my viewController array are the same view, but then why has it worked on all OS's until now? And more importantly any ideas on how I can fix this?
have you used arc ?
check your summary settings in xcode 5.anything can be changed.
problem with released object of your view controller
Please see if you are following these points:
Before calling popToRootViewControllerAnimated: confirm that the RootViewController does actually exist. If it died somewhere along the line, calling the method will cause a crash.
Check the – viewWillDisappear: and – viewDidDisappear: methods of your last view to make sure you're not doing something dangerous there.
Check the dealloc method of the views and their controllers to make sure your not over-releasing something.
Try to use NSZombie and find out the over-released object.