Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 10, 2011, 03:11 AM   #1
ialjumeri
macrumors newbie
 
Join Date: Jan 2011
app crash on the iphone simulator! please help

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
========================================
ialjumeri is offline   0 Reply With Quote
Old Jan 10, 2011, 04:14 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Look very carefully at the NSString documentation. Is the method called StringByReplacingOccrrencesOfString:withString or stringByReplacingOccrrencesOfString:withString. Capitalisation of letters is important.
robbieduncan is offline   0 Reply With Quote
Old Jan 10, 2011, 11:56 AM   #3
Comrade Yeti
macrumors newbie
 
Join Date: Nov 2010
Occurrences

Correct spelling, along with capitalization, is important.
Comrade Yeti is offline   0 Reply With Quote
Old Jan 10, 2011, 12:38 PM   #4
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by Comrade Yeti View Post
Occurrences

Correct spelling, along with capitalization, is important.
Oops. Copy and paste error on my part
robbieduncan is offline   0 Reply With Quote
Old Jan 10, 2011, 05:01 PM   #5
ialjumeri
Thread Starter
macrumors newbie
 
Join Date: Jan 2011
Thanks, guys

Yes, in ( stringByReplacingOccrrencesOfString:withString)

the (s) in the beginning should be small.. I changed it and.. the warning was gone.. fixed

Yet,

the app still does not want to open .. is just trying to launch, but immediately closed...

It seems a common problem for the beginner developer .. !

I cannot go further in learning if this problem still exists..

Help..
ialjumeri is offline   0 Reply With Quote
Old Jan 10, 2011, 05:44 PM   #6
sdd
macrumors newbie
 
Join Date: Jan 2011
Download the books resources if you have not done so already and go into the folder which corrisponds to the tutorial your doing. In there you should see an Xcode project file. Click this and Xcode will open. Use the authors completed code to check your project code matches that. Also check you have connected the outlets and actions correctly in Interface Builder by opening the controller xib file. Use the document plane to see your existing configurations you have set in your File Owner.

Sorry hard typing this on the iPhone
sdd is offline   0 Reply With Quote
Old Jan 13, 2011, 07:03 AM   #7
jnoxx
macrumors 65816
 
jnoxx's Avatar
 
Join Date: Dec 2010
Location: Aartselaar // Antwerp // Belgium
Errr, how bout, Cmd+shift+r.
And show what's in there, or adding breakpoints etc.
jnoxx is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
**HELP** App keeps crashing whenever I try to run in simulator. roddymunro iPhone/iPad Programming 6 Mar 6, 2014 06:00 PM
[Free][Game] Truck Simulator 3D - real simulator! MarusacAlexandr iPhone and iPod touch Apps 0 Jan 11, 2014 01:43 AM
Netflix App makes my iPhone 4S Crash MAC MAN JW iPhone Tips, Help and Troubleshooting 0 Dec 13, 2013 12:25 AM
Core data crash on device not on simulator luke3 iPhone/iPad Programming 1 Jul 8, 2012 05:52 PM
Crash to safe mode after downloading an app from the app store TL24 iPhone Tips, Help and Troubleshooting 0 Jun 26, 2012 07:31 AM

Forum Jump

All times are GMT -5. The time now is 01:08 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC