Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 Display Modes
  #1 (permalink)  
Old August 9th, 2011, 09:34 PM
Registered User
 
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 3: UsingViews

I have started working through the book and have encountered a problem. On Page 49 it instructs us to create a new view based Application and name it UsingViews and then in the UsingViewsViewController.m add the following code to the viewDidLoad method:

UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Hello"
message:@"This is an alert view"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];


Then it says to run the simulator and an alert window will popup. Except, when I run the simulator, the app launches and nothing happens. There is no alert window, it just shows a grey screen with the status bar on the top showing battery life and cell reception...Anyone have an idea as to what I might be doing wrong? Should I upgrade to Xcode 4? I am a complete noob.
Reply With Quote
  #2 (permalink)  
Old August 10th, 2011, 08:56 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

Are you getting any warnings in the console?
Copy and paste your code from your implementation file (…Controller.m) into a reply and/or send your project to
ipadhelper@me.com

and your omission/error should be easy to find.

Bob
Reply With Quote
  #3 (permalink)  
Old August 10th, 2011, 11:08 AM
Registered User
 
Join Date: Aug 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No there were no errors when I launched the simulator. Here is the code:

Code:
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	UIAlertView *alert = [[UIAlertView alloc]
							initWithTitle:@"Hello"
							      message:@"This is an alert view"
							     delegate:self
						cancelButtonTitle:@"OK"
						otherButtonTitles:nil];
	[alert show];
	[alert release];   
    [super viewDidLoad];
}
*/
Reply With Quote
  #4 (permalink)  
Old August 20th, 2011, 03:55 AM
Authorized User
 
Join Date: Jun 2011
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you're viewDidLoad method is not active because it is 'commented out'.
this is due to the
Code:
/*
at the top and the
Code:
*/
at the bottom of your code. remove both of those and run again. while doing so you will be able to observe the code in question not being colored green anymore. green is xcode's color for comments which are ignored by the compiler.
Reply With Quote
  #5 (permalink)  
Old October 3rd, 2011, 04:08 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Execution terminated UsingViews p 49

I am having a problem with the same problem. Execution is aborted with this message [only initial part of message shown]

2011-10-03 15:04:59.104 UsingViews[3580:b303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "UsingViewsViewController" nib but the view outlet was not set.'
Reply With Quote
Reply


Thread Tools
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
Ch. 3 - usingViews Alert and ActionSheet johnoeffinger BOOK: Beginning iPad Application Development 7 August 11th, 2010 11:09 AM
Chapter 6 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 12:02 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 10:40 PM



All times are GMT -4. The time now is 06:22 PM.


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