Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning iOS 4 Application Development
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 18th, 2011, 12:25 AM
Friend of Wrox
 
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
[email protected]
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
 
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
[email protected]
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...
 
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.
 
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...
 
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?
 
Old May 18th, 2011, 11:15 PM
Friend of Wrox
 
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
 
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.





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





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