Iam iphone developer learner, following tutorial was made for iphone 3.0 (just to let u know), and the iphone simulator on iphone 4.2.
what is the issue?
I am exactly following the book i am reading from (Sams Teach yourself iphone application in 24 hours)
when I run the xcode .. the iphone simulator launched and the app crashed immediately before opening it..
how to fix that?
Here I am copying the code..
ooh one more thing it gives me warning on
withString:thePlace.text];
withString:theVerb.text];
withString:theNumber.text];
massage saying " NSString 'may not respond to'-StringByReplacingOccrrencesOfString:withString"
============================================
#import <UIKit/UIKit.h>
@interface FiledButtonFun1ViewController : UITableViewController {
IBOutlet UITextField *thePlace;
IBOutlet UITextField *theVerb;
IBOutlet UITextField *theNumber;
IBOutlet UITextView *theStory;
IBOutlet UITextView *theTemplate;
IBOutlet UIButton * generateStory;
}
@property (retain, nonatomic) UITextField *thePlace;
@property (retain, nonatomic) UITextField *theVerb;
@property (retain, nonatomic) UITextField *theNumber;
@property (retain, nonatomic) UITextView *theStory;
@property (retain, nonatomic) UITextView *theTemplate;
@property (retain, nonatomic) UIButton * generateStory;
-(IBAction)createStoryid)sender;
@end
=====================================
#import "FiledButtonFun1ViewController.h"
@implementation FiledButtonFun1ViewController
@synthesize thePlace;
@synthesize theVerb;
@synthesize theNumber;
@synthesize theStory;
@synthesize theTemplate;
@synthesize generateStory;
-(IBAction)createStoryid)sender {
theStory.text=[theTemplate.text
StringByReplacingOccurrencesOfString"<place>"
withString:thePlace.text];
theStory.text=[theStory.text
StringByReplacingOccurrencesOfString"<verb>"
withString:theVerb.text];
theStory.text=[theStory.text
StringByReplacingOccurrencesOfString"<number>"
withString:theNumber.text];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)dealloc {
[thePlace release];
[theVerb release];
[theNumber release];
[theStory release];
[theTemplate release];
[generateStory release];
[super dealloc];
}
@end
========================================
what is the issue?
I am exactly following the book i am reading from (Sams Teach yourself iphone application in 24 hours)
when I run the xcode .. the iphone simulator launched and the app crashed immediately before opening it..
how to fix that?
Here I am copying the code..
ooh one more thing it gives me warning on
withString:thePlace.text];
withString:theVerb.text];
withString:theNumber.text];
massage saying " NSString 'may not respond to'-StringByReplacingOccrrencesOfString:withString"
============================================
#import <UIKit/UIKit.h>
@interface FiledButtonFun1ViewController : UITableViewController {
IBOutlet UITextField *thePlace;
IBOutlet UITextField *theVerb;
IBOutlet UITextField *theNumber;
IBOutlet UITextView *theStory;
IBOutlet UITextView *theTemplate;
IBOutlet UIButton * generateStory;
}
@property (retain, nonatomic) UITextField *thePlace;
@property (retain, nonatomic) UITextField *theVerb;
@property (retain, nonatomic) UITextField *theNumber;
@property (retain, nonatomic) UITextView *theStory;
@property (retain, nonatomic) UITextView *theTemplate;
@property (retain, nonatomic) UIButton * generateStory;
-(IBAction)createStoryid)sender;
@end
=====================================
#import "FiledButtonFun1ViewController.h"
@implementation FiledButtonFun1ViewController
@synthesize thePlace;
@synthesize theVerb;
@synthesize theNumber;
@synthesize theStory;
@synthesize theTemplate;
@synthesize generateStory;
-(IBAction)createStoryid)sender {
theStory.text=[theTemplate.text
StringByReplacingOccurrencesOfString"<place>"
withString:thePlace.text];
theStory.text=[theStory.text
StringByReplacingOccurrencesOfString"<verb>"
withString:theVerb.text];
theStory.text=[theStory.text
StringByReplacingOccurrencesOfString"<number>"
withString:theNumber.text];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)dealloc {
[thePlace release];
[theVerb release];
[theNumber release];
[theStory release];
[theTemplate release];
[generateStory release];
[super dealloc];
}
@end
========================================