Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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
  #1 (permalink)  
Old February 10th, 2011, 10:59 PM
Registered User
 
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default New to Programming

Hello. I am up to page 36 in Hello world. I have followed the step by step guide, but for some reason the iOS simulator does not show the icon for Hello World. Also, after putting in all the codes for h and m, the Hello World button clicked will not work. Any suggestions? I am going to re-run the steps from the beginning to see if I missed something.

Also, I am noticing that the book is a little different that the screens I am seeing. I am runnign 4.2. Can you help?
Reply With Quote
  #2 (permalink)  
Old February 11th, 2011, 09:01 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

Without seeing you code, it is impossible to try and diagnose any errors. Copy and paste the code into a reply.
I don't have this book, but do have the prior book by the author, with many of the same projects, so I can't address possible omissions in the current book's text. In the prior book one step that was frequently omitted was the need to save changes after working in Interface Builder (i.e. connect an outlet and/or action and now return to Xcode without mentioning "Save your work" before returning to Xcode.) Saving changes in IB must be done for Xcode to know about them.
If you post your code and everything looks good, the problem will most likely be related to an unsaved outlet or action connection.
A way to check connections while running the program is to insert NSLog statements in the action methods (or any method you want to verify is being called) and have the console log open as you run the program. This way you can trace the flow of the program.
Bob
Reply With Quote
  #3 (permalink)  
Old February 11th, 2011, 11:09 PM
Registered User
 
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks for helping me

I tried another shot at making making the outlet and actions project work, but no luck. Is this book outdated, because the code is not turning the right color as it is in the book. Here is the code from .h and.m. For some reason the *txtName is not turning green and anything with a * is not turning the right color. Also, dealloc and str is being flagged.

#import <UIKit/UIKit.h>

@interface OutletsAndActionsViewController : UIViewController {
//---declaring the outlet---
IBOutlet UITextField *txtName;
}

//---expose the outlet as a property---
@property (nonatomic, retain) UITextfield *txtName;


//---declaring the action---
-(IBAction) btnClicked:(id) sender;

@end


from .m:

#import "OutletsAndActionsViewController.h"

@implementation OutletsAndActionsViewController

//---synthesize the property---
@synthesize txtName;

//---displays an alert view when the button is clicked---
-(IBAction) btnClicked:(id) sender {
NSString *str = [[NSString alloc]
initWithFormat:@"Hello, %@", txtName.text];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Hello!"
message:str
delegate:self
cancelButtonTitle:@"Done"
otherButtonTitles:nil];
[alert show];
[str release];
[alert release];
}

- (void)dealloc {
//---releasing the outlet---
[txtName release];
[super dealloc];
}
Reply With Quote
  #4 (permalink)  
Old February 11th, 2011, 11:44 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

The code you have provided doesn't compile without errors because of a typo

@property (nonatomic, retain) UITextfield *txtName;

Should be

@property (nonatomic, retain) UITextField *txtName;

I set up a project, copy and pasted your code into it, fixed that typo, set up the view in Interface Builder, compiled ran and everything is fine.
Fix that typo and see if it runs.
If not email the project files to
ipadhelper@me.com
and I will debug.
Bob
Reply With Quote
  #5 (permalink)  
Old February 12th, 2011, 07:56 AM
Registered User
 
Join Date: Feb 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Any advice

Thanks so much for your help. It was a simple stupid mistake and that the book never told me to push "Build and run." then two errors popped up and I followed the code perfectly, so I am not sure what to do at this point. I will send it to you for debugging.

My future problem is not interface builder or designing the programs, but coding. HTML, CSS and Java are easy to understand, but Cocoa is out there. I have been looking for a site where I can get codes to cut and paste for certain actions, but I can not find any. Do you know any? Also, I have programmed tons of websites, by using other people's source codes and changing them to what I want. Is there a way to get a source code for .h and .m for an app? You have been a great help.
Reply With Quote
  #6 (permalink)  
Old February 12th, 2011, 09:29 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

I will be happy to check out the issues with your project. It is easier to do from the actual project, so sending it is the best suggestion. Visual inspection is slower than compiling and using errors and warnings to spotlight errors, and potential problems stemming from Interface Builder are not visible in code.

I have never looked for 'sources' of source code. There are many projects included with the developer tools, and on Apple's developer site. These can be modified.

A good understanding of Objective C 2.0 and the Foundation Classes is essential in making smooth progress, in my opinion. Having experience and success at writing backend code in the Xcode environment will help with the move into the interface aspects. If you don't know Obj C, haven't used Xcode and are diving into iOS or Cocoa frameworks all at the same time it will be overwhelming. Fortunately Obj C is not that hard to learn, and Java, which you said you have used, borrows a number of concepts from it (with different names). Setting up working outlets and actions will not be hard once you have successfully done it a couple of times.
The next thing is to grasp the concept of delegates, and read the documentation to find out what existing objects already know how to do. After this, using the generic controllers and bindings is the next step.

The best resource for Objective C 2.0 is from a different publisher, and I would be happy to PM or email the title and support site link to you.

If you send the project, I should be able to find out where you took a wrong turn and hopefully steer you in the right direction. I have a rehearsal most of the day so, may not get back to you immediately.

Also, I don't have this book but do have the prior version, from which many of the projects have been recycled. You mentioned that the Build and Run step was omitted. The earlier book does say Press Command-R which is the same as Build and Run.

Bob
Reply With Quote
  #7 (permalink)  
Old February 12th, 2011, 01:02 PM
Authorized User
Points: 49, Level: 1
Points: 49, Level: 1 Points: 49, Level: 1 Points: 49, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2011
Posts: 13
Thanks: 5
Thanked 0 Times in 0 Posts
Default "best resource for Objective C 2.0"

@thepianoguy
Bob, I'd be very interested to hear your recommendation.

Do you really think wrox would be uptight about mentioning it in the open?
Seems like the feedback would be useful for them, maybe motivation to come up w/ something better!

thx!
Reply With Quote
  #8 (permalink)  
Old March 23rd, 2011, 12:18 AM
Registered User
 
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Bob, I was reading your pos about learning Xcode, Obj C, iOS, Cocoa Frameworks, etc. I would be unterested to hear your recommendations, in what/how to learn, as most of this is new to me..... I have worked through some Unix/Terminal/Mac books is about all, and I'm interested in iOS app development.
I am currently working through the Beginning iOS 4 Application Development Book

Thank You!
Mike
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
Do u know PHP Programming is Most Used Programming Language annaawills Beginning PHP 5 March 8th, 2010 09:48 AM
device DLL programming in client side programming hendyhanusin ASP.NET 1.0 and 1.1 Professional 2 February 19th, 2009 12:01 PM
device DLL programming in client side programming hendyhanusin ASP.NET 1.0 and 1.1 Basics 0 March 21st, 2007 08:05 AM
device DLL programming in client side programming hendyhanusin ASP.NET 2.0 Professional 1 March 21st, 2007 08:04 AM
Qt programming, bugs in first programming sateeshgalla BOOK Beginning Linux Programming, 3rd Edition 0 October 14th, 2005 08:19 AM



All times are GMT -4. The time now is 07:45 AM.


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