Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning iOS 4 Application Development
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning iOS 4 Application Development
This is the forum to discuss the Wrox book Beginning iOS 4 Application Development by Wei-Meng Lee; ISBN: 978-0-470-91802-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old May 18th, 2011, 12:25 AM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

If you can't work out the problem, send your project to
ipadhelper@me.com
and I will take a look at it for you.


Previous versions of Xcode auto-completed the file name forward declaration after @class, as of now Xcode 4 does not. Hopefully that will be remedied in the future.

Bob
Reply With Quote
  #12 (permalink)  
Old May 18th, 2011, 09:23 AM
Registered User
 
Join Date: May 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by thepianoguy View Post
If you can't work out the problem, send your project to
ipadhelper@me.com
and I will take a look at it for you.


Previous versions of Xcode auto-completed the file name forward declaration after @class, as of now Xcode 4 does not. Hopefully that will be remedied in the future.

Bob
Thank you for your proposition. Before I will try again to solve it by myself. Another 24 hours and I give-up!

By the way, looking at the dowloaded source code, I find out that there is nothing in the Nib field of the MainWindow's HelloWorldViewController.
I then remove it from my project and suddenly the autocomplete for the @class is working!!!
But the application still show the empty screen...
Reply With Quote
  #13 (permalink)  
Old May 18th, 2011, 09:28 AM
Registered User
 
Join Date: Jan 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know if this will possibly help or not, but I literally deleted and recreated the entire project to get it to work. Very frustrating.

Best of luck.
Reply With Quote
  #14 (permalink)  
Old May 18th, 2011, 09:30 AM
Registered User
 
Join Date: May 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by lukasbradley View Post
I don't know if this will possibly help or not, but I literally deleted and recreated the entire project to get it to work. Very frustrating.

Best of luck.
I already did that twice... No success. Maybe a clean is needed before recompiling and running? I will try that tonight...
Reply With Quote
  #15 (permalink)  
Old May 18th, 2011, 08:56 PM
Registered User
 
Join Date: May 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by tleveque View Post
I am also unable to make it work!

I did it twice with the same result.
And yes I did a save after each edition of .xib files...

I started suspecting something is not going well at step 9, when they ask to select HelloWorldViewController as NIB name. For me, the drop down list was empty!
So I typed it manually.

I also supposed XCode should be able to autocomplete the class name after the @class. I am right? If yes, there is no HelloWorldViewController in my autocompletion list...

I double and even tripple check all my code and it still does not work.
No compilation errors or any warning. The iPhone Simulator just show a blank screen....

I am using XCode 4. But it should not make any difference I think.

Any idea someone?
I solved my problem!!!
The fault is on Xcode 4!
When Xcode create the windowBasedAppAppDelegate.m file, the synthesize for window property is created like this:
Code:
@synthesize window=_window;
Instead of just:
Code:
@synthesize window;
And of course, in my didFinishLaunchingWithOptions method I used:
Code:
[window addSubview:viewController.view];
I didn't use _window.

Removing the =_window and the '_' in the dealloc method solved the problem.

Now, can anybody explain why is Xcode 4 is doing that?
Reply With Quote
  #16 (permalink)  
Old May 18th, 2011, 11:15 PM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

Xcode is trying to make you use your accessors correctly, and to signify that the window variable is private. You should not remove the underscore. When accessors are used correctly, you minimize potential errors with memory management. Setting the variable directly can cause issues with object ownership. The correct solution (leaving the underscore in) is to replace the book code as follows:

Code:
[self.window addSubview:mySecondViewController.view];

[self.window makeKeyAndVisible];


[self.window release];
Bob
Reply With Quote
  #17 (permalink)  
Old May 24th, 2011, 04:31 PM
Registered User
 
Join Date: May 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had problems with this chapter using XCode 4, as well -- and the first of them was when I created the "HelloWorldViewController" classes, because XCode 4 prompts you to choose a template and then choose a subclass and then give it a name.

It's been some time since I'd last used XCode 3, so I just assumed that the second window was the file naming option, because it seemed familiar (particularly when you don't look closely enough) -- which created a "HelloWorldViewController" superclass (or something) where there shouldn't have been one.

Once I noticed my mistake, and altered some of the "window" code, everything was swell.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 1 javascript won't work Bob Sulewski BOOK: ASP.NET 4 24-Hour Trainer 6 January 31st, 2012 08:18 AM
chapter one doesn't work in rails 2.0.2 wanguan2000 BOOK: Beginning Ruby on Rails 15 May 16th, 2009 11:39 PM
Chapter 1 Ctrl+F5 don't work, F5 does work? jimboak BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 June 29th, 2008 03:46 AM
a example of chapter doesn't work. mizimizi Classic ASP XML 2 October 19th, 2003 01:27 PM



All times are GMT -4. The time now is 07:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.