Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
Probably a really newbie question but I can't seem to get it to work.
I want to change the startpage when the app opens. Currently it opens at Table View, but I would like to have it started at "Edit info View Controller".

I tried several things, but in all variations I got errors.
Screenshot of current setup attached.
Any help really appreciated.
 

Attachments

  • Screen Shot 2014-08-02 at 00.34.05.png
    Screen Shot 2014-08-02 at 00.34.05.png
    33.2 KB · Views: 219

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
I would delete the navigation controller and then embed the "Edit View Controller" in a new navigation controller. Then create a new segue to the table view
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
I would delete the navigation controller and then embed the "Edit View Controller" in a new navigation controller. Then create a new segue to the table view

Hello AxoNeuron, thx for answering, as per your suggestion I've deleted the navigation controller, and embedded the "Edit info View Controller in a new navigation controller using "Editor" menu, "embed in Navigation Controller". I then created a modal segue from View controller to edit view controller and vice versa. But both didn't work. One crashed and the other one still starts at the View controller.

Also change relationship "Root view controller to Detail didn't work.
 

Attachments

  • Screen Shot 2014-08-02 at 10.14.10.png
    Screen Shot 2014-08-02 at 10.14.10.png
    113 KB · Views: 191

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
Hello AxoNeuron, thx for answering, as per your suggestion I've deleted the navigation controller, and embedded the "Edit info View Controller in a new navigation controller using "Editor" menu, "embed in Navigation Controller". I then created a modal segue from View controller to edit view controller and vice versa. But both didn't work. One crashed and the other one still starts at the View controller.

Also change relationship "Root view controller to Detail didn't work.

I've never seen a segue from a view controller to a navigation controller before. Try getting rid of it. Instead of segueing BACK to the other view controller, use the method dismissViewControllerAnimated and do that in a delegate method inside of the primary view controller.

On the far left on the table view, that little arrow indicates which view controller the application starts on. Try moving that to the other controller.
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
On the far left on the table view, that little arrow indicates which view controller the application starts on. Try moving that to the other controller.

Ok, I've managed to make a small step forward; the arrow points to the VC that should be activated on startup. Unfortunately I now have the error: unsupported configuration scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier.
 

Attachments

  • Screen Shot 2014-08-02 at 22.05.35.png
    Screen Shot 2014-08-02 at 22.05.35.png
    98.4 KB · Views: 160

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
Try using a modal segue perhaps from the table view controller to the secondary view controller? Is anything in your "Edit Info" view controller dependent on information coming from the table view controller?

As it stands, does the actual segue itself work?
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
Try using a modal segue perhaps from the table view controller to the secondary view controller? Is anything in your "Edit Info" view controller dependent on information coming from the table view controller?

As it stands, does the actual segue itself work?

A modal segue didn't work for changing the startup page.
Everything else works as it should.

The initial goal was to make a startpage that contains a text input field, and when clicking save the name (text input) was stored in the SQLite database, ready to be exported as a text file when finished adding data. Basically I only need 1 page. I couldn't make this work, so a lot of research brought me to the following alternative. Maybe I started completely wrong and making this too complicated.
 

JohnsonK

macrumors regular
Mar 6, 2014
142
0
I am not sure if I understood correctly but:
  1. - Delete all your segues, including the one from the UINavigationController to your UITableViewController
  2. - You will now have three independent controllers floating. Rearrange your controllers to the desired order
  3. - Drag a segue from your UINavigationController to your EditViewController. Select root view controller from the drop down menu
  4. - Drag a segue from your EditViewController to your UITableViewController
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
I am not sure if I understood correctly but:
  1. - Delete all your segues, including the one from the UINavigationController to your UITableViewController

If I delete all segues, I also delete the Navigation item of the Edit View controller (that contains Title and Save).
I've uploaded the files if you want to look at the code http://www.saeys.org/SQLite.zip
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
Follow the rest of the instructions ;)

The title appeared again :)

Unfortunately I have two errors now:
Unsupported configuration: Segues initiated directly from view controllers must have an identifier for use with -[UIViewController performSegueWithIdentifier:sender]

I gave the controllers both a StoryBoardID but that didn't seem to help.
Any suggestions?
 

JohnsonK

macrumors regular
Mar 6, 2014
142
0
The title appeared again :)

Unfortunately I have two errors now:
Unsupported configuration: Segues initiated directly from view controllers must have an identifier for use with -[UIViewController performSegueWithIdentifier:sender]

I gave the controllers both a StoryBoardID but that didn't seem to help.
Any suggestions?

The segue from your EditViewController to your UITableViewController needs an identifier. Select it and give it one.

Also note that you are going to have to update your code with the new identifier and perhaps update your app's logic as well since you have changed the way it works.

Forget the storyboard id, there is no need for it
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
The segue from your EditViewController to your UITableViewController needs an identifier. Select it and give it one.

Also note that you are going to have to update your code with the new identifier and perhaps update your app's logic as well since you have changed the way it works.

Forget the storyboard id, there is no need for it

The errors are gone, but the application crashes: libc++abi.dylib: terminating with uncaught exception of type NSException.
 

Attachments

  • Screen Shot 2014-08-03 at 01.02.41.png
    Screen Shot 2014-08-03 at 01.02.41.png
    121.5 KB · Views: 195

JohnsonK

macrumors regular
Mar 6, 2014
142
0
The errors are gone, but the application crashes: libc++abi.dylib: terminating with uncaught exception of type NSException.

We need more than simply "it crashes" :p

Crashes when doing what? Also please copy and paste the entire log
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
We need more than simply "it crashes" :p

Crashes when doing what? Also please copy and paste the entire log

Sorry, the iOS simulator crashes when going to "Product" and select "Run".
Simulator start op normally, as soon as te app loads it crashes immediately (only black screen is visible after launch of the app)


LOG:
2014-08-03 01:27:19.386 SQLite3DBSample[3844:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x018df1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0165e8e5 objc_exception_throw + 44
2 CoreFoundation 0x018938b2 -[__NSArrayI objectAtIndex:] + 210
3 SQLite3DBSample 0x00002def -[EditInfoViewController loadInfoToEdit] + 351
4 SQLite3DBSample 0x000025ff -[EditInfoViewController viewDidLoad] + 719
5 UIKit 0x0043d33d -[UIViewController loadViewIfRequired] + 696
6 UIKit 0x0043d5d9 -[UIViewController view] + 35
7 UIKit 0x00468509 -[UINavigationController rotatingSnapshotViewForWindow:] + 52
8 UIKit 0x007afe3c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 420
9 UIKit 0x00364c22 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 1495
10 UIKit 0x00364646 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
11 UIKit 0x00364518 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
12 UIKit 0x003645a0 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
13 UIKit 0x0036363a __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
14 UIKit 0x0036359c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
15 UIKit 0x003642f3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
16 UIKit 0x003678e6 -[UIWindow setDelegate:] + 449
17 UIKit 0x00441b77 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
18 UIKit 0x0035d474 -[UIWindow addRootViewControllerViewIfPossible] + 591
19 UIKit 0x0035d5ef -[UIWindow _setHidden:forced:] + 312
20 UIKit 0x0035d86b -[UIWindow _orderFrontWithoutMakingKey] + 49
21 UIKit 0x003683c8 -[UIWindow makeKeyAndVisible] + 65
22 UIKit 0x00318bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097
23 UIKit 0x0031d667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
24 UIKit 0x00331f92 -[UIApplication handleEvent:withNewEvent:] + 3517
25 UIKit 0x00332555 -[UIApplication sendEvent:] + 85
26 UIKit 0x0031f250 _UIApplicationHandleEvent + 683
27 GraphicsServices 0x038d4f02 _PurpleEventCallback + 776
28 GraphicsServices 0x038d4a0d PurpleEventCallback + 46
29 CoreFoundation 0x0185aca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
30 CoreFoundation 0x0185a9db __CFRunLoopDoSource1 + 523
31 CoreFoundation 0x0188568c __CFRunLoopRun + 2156
32 CoreFoundation 0x018849d3 CFRunLoopRunSpecific + 467
33 CoreFoundation 0x018847eb CFRunLoopRunInMode + 123
34 UIKit 0x0031cd9c -[UIApplication _run] + 840
35 UIKit 0x0031ef9b UIApplicationMain + 1225
36 SQLite3DBSample 0x00004ccd main + 141
37 libdyld.dylib 0x01e28701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
 

JohnsonK

macrumors regular
Mar 6, 2014
142
0
Oh, as I said earlier, you have to change your app's logic.

From your crash log, because the EditViewController used to come after your UITableViewController, EditViewController expects to be "fed" by an object from your UITableViewController. As it is now coming before the UITableViewController, the method "loadInfoToEdit" in EditViewController has nothing to load and therefore crashes.
 

stefansaeys

macrumors newbie
Original poster
Jul 30, 2014
11
0
Oh, as I said earlier, you have to change your app's logic.

Not sure how to do this; information that I found related to xcode 4. Is it remove Bundle Loader and Test Host or does it refer to Choose File > New > New Target and selecting Cocoa Touch Unit testing bundle from the menu?
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
It seems to me that something in the Edit Info view controller is dependent on information coming from the table view controller. It looks like it's trying to access an object from an empty array, causing the crash.

I'm just a beginner, just started learning about table views and delegates last week so that's all I can really say. I'd be interested in hearing the thoughts of others about this problem.
 

JohnsonK

macrumors regular
Mar 6, 2014
142
0
Not sure how to do this; information that I found related to xcode 4. Is it remove Bundle Loader and Test Host or does it refer to Choose File > New > New Target and selecting Cocoa Touch Unit testing bundle from the menu?

No, I meant change the actual code. The app was programmed to have the EditViewController populated by the UITableViewController.

You have modified the storyboard to show the EditViewController before the UITableViewController, now you have to modify the actual code to support the changes you have made.

I suggest taking a few steps back and start learning programming from the very beginning, before diving into more complex stuff
 

grandM

macrumors 68000
Oct 14, 2013
1,508
298
I could be mistaken but if I understand your goal there is nothing wrong with your initial setup. If you aim to
1 have a tableview containing names and
2 selecting a name segue ways into your edit page and
3 you want to add names and its data

You should just ctrl-drag from the orange + to the EditViewController [with an appropriate identifier etc]. As to starting with the EditViewController: why not add a method in viewDidLoad seguewaying to the EditViewController [with indexPath.row = count of your NSArray of names +1]?
 
Last edited:

DannyBres

macrumors 65816
Oct 30, 2007
1,412
6
UK
Wow, I have never taken the time to learn storyboard properly and I am glad I have never.

I assume the edit menu is editing the content of your table view.

If it were me i would not use a storyboards and set the RootViewController in applicationDidFinishWithOptions in your AppDelegate to the UITableViewController.

On viewWillAppear for the UITableView present the edit controller modally.

Then when you dismiss the model edit view, you will be back in your tableView. :) Which is where I assume the user will spend 90% of their time.

Hope this helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.