02 Oct 2008, 04:18
Generic-user-small

Phillip Koebbe (13 posts)

I’m not getting the desired results with the Starter project that begins in section 2.2 on page 26 of the B1.0 printing. I have followed the directions accurately and even went back through them to make sure. I discovered one thing that was left out: I needed to add

#import "EditorViewController.h"

to StarterViewController.h so it would recognize the EditorViewController class. Beyond that, I’ve done everything the book says, but when I run the application and press the button, I do not get the modal view. I get a blank white screen.

Peace, Phillip

02 Oct 2008, 10:42
Sgaw_avatar_pragsmall

Simon Wolf (6 posts)

Phillip, in StarterViewController.xib select the EditorViewController object you added on page 34 and make sure you have set the nib file name attribute. This is right at the bottom of the page and I missed it too.

Simon

02 Oct 2008, 13:56
Generic-user-small

Hannu Kuusi (2 posts)

It’s probably a good idea to add the problems with the starter project to this thread. I got everything else running fine, but when I edit the text and press “Done” nothing happens.

I have checked trough the code several times and haven’t found anything wrong with it.. :/

02 Oct 2008, 14:26
Generic-user-small

Michael Newsom (2 posts)

Looking through the code online I noticed there’s a lot of stuff that isn’t mentioned in the text for this project. But replacing all my code with the official version still didn’t work. I’m a noob and I’m stuck.

02 Oct 2008, 14:42
Generic-user-small

Hannu Kuusi (2 posts)

I got it quite far now.

Only things that don’t work are: 1. autofocus on the textfield after pressing button. 2. change of the label text after editing the text field.

I keep toying around to find out what’s going wrong :)

02 Oct 2008, 14:43
Sgaw_avatar_pragsmall

Simon Wolf (6 posts)

I’m going to guess that if you’ve done a code comparison between your own versions and the downloadable version then the problem lies in one of your xibs. One thing to check is whether in the Editor.xib, you have set the delegate for the text field to be the File’s Owner.

02 Oct 2008, 15:00
Soundlab_avatar_pragsmall

Nicky Peeters (1 post)

Yeps, after following the text letter-by-letter my build failed.

What I fixed following the errors and warnings after a build:

StarterViewController.m, since we added an @property for editViewController in the header file, the implementation file needs an @synthesize:

@synthesize editorViewController;

Same deal in EditorViewController.m, since the header file has an @property for field:

@synthesize field;

Lastly, my StarterViewController failed to bring up the view from the Editor nib because the EditorViewController outlet created in StarterViewController.h wasn’t connected in StartViewController.xib.

To fix this, control click the File’s Owner in StartViewController.xib, and drag from the editorViewController outlet to the EditorViewController instance you added (the orange bubble/ball with the square in it).

Hope this helps and am I glad we finally can help each other legally this way. Thanks Apple!

02 Oct 2008, 17:48
Generic-user-small

Marco Chareyron (2 posts)

Yep, it was the missing delegate link and the NIB file name attribute also in my case.

I’ve also substituted every dot notation with the corresponding getters and setters methods.

02 Oct 2008, 18:58
Generic-user-small

Phillip Koebbe (13 posts)

@Simon: Thanks for the thought, but the NIB name was set correctly.

@Nicky: I picked up on the @synthesize editorViewController last night (forgot to mention that in my earlier post), but missed the @synthesize field. Funny thing is that I didn’t get any build errors on field but did on editorViewController. What I was missing, though, was the EditorViewController outlet link in StarterViewController.xib that you pointed out. Once I did that, the editor view displays now.

@Hannu: Autofocusing the text field when entering the modal view works correctly for me. What doesn’t work, however, is pressing the done button to return to the main view. Does that work for you (or anyone else)?

“Yay!” for no NDA!

Peace.

02 Oct 2008, 19:10
Generic-user-small

Phillip Koebbe (13 posts)

@All: It appears to be working correctly now. I was scanning back through the posts and Simon’s statement

One thing to check is whether in the Editor.xib, you have set the delegate for the text field to be the File’s Owner.

solved my last problem.

Thanks Simon, Nicky, and everyone else. I’ve been programming for a long time, but there’s something about Obj-C that is rattling my brain.

Peace.

02 Oct 2008, 20:48
Sgaw_avatar_pragsmall

Simon Wolf (6 posts)

Because I too had the project fail on my first attempt with it I’m going to suggest that the individual steps are highlighted in some way to differentiate them from the narrative more clearly.

02 Oct 2008, 20:51
Biopic_100x100_pragsmall

Bill Dudney (917 posts)

Thanks Simon and everyone else for the great feedback. Sorry it was not clearer in the first place :)

I’m in the midst of a rework of this chapter as I type this. Next beta will have all the changes and corrections suggested.

Thanks again!

05 Oct 2008, 05:52
Generic-user-small

Damian Haslam (18 posts)

I compared my code (as typed) with the version downloaded, and there were a number of differences. The main one being in StarterViewController.h there was never any mention of @class EditorViewController;

That was in the code online, but not mentioned in the book. You don’t need the @synthesize line people talk about above (I don’t think?)

I also missed the EditorViewController outlet link described above.

Phew!

05 Oct 2008, 09:39
Generic-user-small

Povl H. Pedersen (3 posts)

I too had problems. At end of 2.6 I thought I should compile and run. Did not work. Then I tried some debugging, and then came here, where I at first was more confused, until I found out to continue to 2.7, and everything was fine.

BTW: 2.4 Configuring the Text field is placed too far away from where we add the text field. It seems to be put in the wrong place.

And in general, I think the figures are way too far away from where they are referenced. This is no good in a PDF version, but might work if you are sure it is on opposing pages in the print book.

05 Oct 2008, 11:00
Biopic_100x100_pragsmall

Bill Dudney (917 posts)

Hi All,

Sorry for the confusion. The updated version of this chapter is in the latest beta (10/3).

Hopefully all these issues are cleared up now.

Thanks again for taking the time to let us know!

05 Oct 2008, 13:45
Generic-user-small

Povl H. Pedersen (3 posts)

I had the problems in the 10/3 version. I thought after 2.6 that I was more or less there. It was my fault, but the end of 2.6 could be rephrased to indicate you need all 2.7.

Still, the keyboard section is in the wrong place.

06 Oct 2008, 10:20
Generic-user-small

Tomasz Ondrusz (9 posts)

Hi, I have most of the Starter app built, however I have a problem when returning from the edit view, in that the textField variable ‘field’ always appears to be null, and therefore does not update the StarterViewScreen.

I have verified that this is so with the following code (in EditorViewController):

-(BOOL)textFieldShouldReturn:(UITextField *)textField {
	[textField resignFirstResponder];
	NSLog(@"textFieldShouldReturn has been called with field text: %@", field.text);
	return YES;
}

-(void) textFieldDidEndEditing:(UITextField *) textField {
	NSLog(@"textFieldDidEndEditing has been called");
	NSLog(@"the value of field.text is: %@", field.text);
	[self dismissModalViewControllerAnimated:YES];
}

My console reports: 2008-10-06 11:00:14.646 Starter[2805:20b] textFieldDidEndEditing has been called 2008-10-06 11:00:14.647 Starter[2805:20b] the value of field.text is: (null) 2008-10-06 11:00:14.648 Starter[2805:20b] StarterViewController viewWillAppear has been called 2008-10-06 11:00:14.649 Starter[2805:20b] textFieldShouldReturn has been called with field text: (null)

Fixed it!

Somehow I have missed connecting the @field@ textField in EditorViewController.xib back to the FileOwner proxy.

06 Oct 2008, 10:22
Biopic_100x100_pragsmall

Bill Dudney (917 posts)

Hi Tomasz,

Looks like the ‘field’ outlet is not connected in IB to the UITextField. Its just a guess but from the description it sounds reasonable.

Good luck and let me know if it works.

06 Oct 2008, 10:34
Generic-user-small

Tomasz Ondrusz (9 posts)

Hi Bill,

Yeah that was it. Many thanks, and keep up the good work!

T.

06 Oct 2008, 21:05
Generic-user-small

John Smits (1 post)

One other thing not yet mentioned it this post is that the download link at the bottom of page 33 to StarterViewController.m opens the StarterAppDelegate.m source code instead of StarterViewController.m

For me this made it a bit difficult to find out what the problem was. Well the above EditorViewController outlet connection StarterViewController.nib did the job. Thanks (on the the next chapter)

  You must be logged in to comment