UISplitViewController with NavigationControllers (including sample code) - iphone

The easiest way to see this problem will be to run the sample project here:
http://drop.io/stackproblem
Basically, It's a uisplitviewcontroller which can be switched between 2 detail views, both of which are navigation controllers.
The problem is that it crashes with the following error:
MultipleDetailViews[8531:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Popovers cannot be presented from a view which does not have a window.'
It crashes with this error if you use the app in PORTRAIT and you navigate (still in portrait) from the first controller, to the second, to the first, to the second, and then boom CRASH using the popover controller.
One way to stop the crash is to stop lazy loading the navigation controllers and to load them fresh everytime but this isn't an option for the app I'm making.
Any ideas and I may fall in love.

Try using if (self.view.window != nil) just before the line that's causing the crash.

Related

My app crashes and does not change views when I tell it to

My app crashes and does not change views when I tell it to. I have tried many other things but I can not get it to change programmatically for the life of me. I have attached my Workspace. Any help would be great!!!
Image
This code changes the view to this
self.messagesController?.setupNavBarWithUser(user)
How do I go to this view in my storyBoard correctly.
Here is my error code
2018-12-17 07:56:00.777229-0500 Kind Point[7129:524001] ***
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Could not find a storyboard
named 'MessagesController' in bundle NSBundle
</Users/Jake/Library/Developer/CoreSimulator/Devices/C748FA7B-1F41-49C3-8A72-F3A39E494146/data/Containers/Bundle/Application/C824E34D-60DB-4CEC-8FEF-9BC939AF20C8/Kind
Point.app> (loaded)'
*** First throw call stack:
If you are using buttons, I suggest disconnecting the outlet/remove the segue from the button and re-add it.
Your terminal log says that there is no storyboard named MessagesController so, try adding a new view, or swift file and name it MessagesController. Add the messagesController to the view controller and see if it works.
To add a new view controller file to a storyboard, just copy and paste the code from one view controller and paste it to a new swift file. Then, change the name in the top of the code from ViewController, to the name of the view controller you want.

UIActivity Duplicate Calls to 'activityViewController'

I have a UIActivity that implements the activityViewController method. Everything works fine, except when a user quickly double taps on the icon for my activity. This causes duplicate calls to the method and crashes with:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller .'
I am using a custom UIActivityItemProvider as data that makes a server call (and can be slow) and this seems to be the cause of the issue.
How can I make sure two view controllers aren't being presented?
Note: This is being done through the UIActivityViewController so I don't think I have access to any buttons to disable them.
disable that button after first click, and enable after dismiss that activityViewController

how to create infinite looping in navigation controller like instagram application in iphone?

i am developing an application which would have many subviews like the flow of instagram and picyou kind of social networking apps the flow is image->detail image->any comment->username->following->username->image username->image->detail image->any comment->username->following->username->image username->damn this is infinite never stops.....
and never gets memory warning or crashed by memory issue...
i am using navigation controller but still after some time of navigation changing some viewcontrollers it gives me error like this *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported (<ViewController: 0x6d97110>)'
i want to do same like this on pressing back you will also get all datas back. do you have any idea how to do like this.?
UINavigationController automatically supports this behavior you are describing. Memory efficient and potentially infinite.
Every time you want to go from one piece of your app to the next you just use code similar to this.
ViewController *vc = [[ViewController alloc] init];
//customize ViewController
[self.navigationController pushViewController:vc animated:YES];
So if you want to go from a photo to a photo detail view, you just push the photo detail view controller when the button is pressed. Even if your in a photo detail view controller already you can push another one from that class. Just make sure you create a separate instance. Judging by your error, I think that is your problem now.
I have also found it best to create a custom initializer for these kinds of view controllers. For a photo detail view use something like.
-(id)initWithPhoto:(Photo*)photo;

IPhone app use core-plot (What to fix)?

i'm making iphone app that use Core-Plot chart. The app have "SavolaViewController as a main class that include a button and when button clicked it's GoTo to another class named "ChartViewController" by this code
ChartViewControllerVar = [[ChartViewController alloc]initWithNibName:#"ChartViewController" bundle:nil];
[self presentModalViewController:ChartViewControllerVar animated:YES];
I have read about core-plot for 4-6 hours and i have not understand any of the tutorials(it's not understandable) [({"Please dont answer with tutorial link"})]
I have coped the Core-Plot code from the example in Core-Plot .zip file(you'll find the code in the link bellow).
and i have this msg in the console
2012-07-15 16:38:31.325 Savola[13105:f803] * Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason:
'-[UIViewController _loadViewFromNibNamed:bundle:] loaded the
"ChartViewController" nib but the view outlet was not set.'
* First throw call stack: (0x140a022 0x19c2cd6 0x13b2a48 0x13b29b9 0x4102dd 0x410779 0x41099b 0x4199bc 0x414818 0x630565 0x417857
0x4179bc 0xca94792 0x4179fc 0x9a4f 0x3da5c5 0x3da7fa 0xc6f85d
0x13de936 0x13de3d7 0x1341790 0x1340d84 0x1340c9b 0x228f7d8 0x228f88a
0x349626 0x8c0a 0x2c55) terminate called throwing an exception(lldb)
What i want(If you can)
Fix the code to run in my app.
What does i need to but in the .xib file.
delete the codes unneeded.
The code
This has nothing to do with Core Plot. You have an IBOutlet in your .xib that's not connected properly.

crashing on ios device while navigation using UIModalTransitionStylePartialCurl in xcode 4

i am using UIModalTransitionStylePartialCurl on the ios 4 device,in my test app i have 2 classes where a single button in each class, in first page onclick of the button it ill navigate to 2nd page (by curling the page up) but in the 2nd page when i click backbutton its crashing but not navigating back to my first page
following is my code used for navigation
ViewController *MainWin = [[QIAViewController alloc] initWithNibName:NULL bundle:NULL];
MainWin.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:MainWin animated:YES];
[MainWin release];
this is the crash log:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nested modal view controller while curled <QIAAdminPassCnf: 0x583e040>.'
*** Call stack at first throw:
If you read the documentation for UIModalTransitionStylePartialCurl, you will see that once you've used it you can't present any more modal views.
If you want to navigate back, I think you should do,
[self dismissModalViewControllerAnimated:YES];
rather than creating a new view controller instance.
You may well have added the Action twice in Interface Builder. Go to the ViewController and to the Triggered Segues on the right and "x" do delete the extra one. LOL