Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-08-2010, 04:52 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 1
abramodj is on a distinguished road
Default unrecognized selector sent to instance 0x5d18d60

Hi everybody. I'm going crazy with this my little app... Please help me!!!

this is the source code of the app: smoking.zip

It only saves a .dat file with an NSMutableArray. Now, the first time you will launch the app, try to click the cigarette button sometimes: Everything should working fine. Ok, now close the app, re-open it, and click again on the button. This time the app will crash with the "unrecognized selector sent to instance 0x5d18d60" error. I was sure the problem was in saving the data, because when i commented the line "[theData writeToFile:dataFilePath atomically:YES];" in the "saveData" method the error disappeared. Later i discovered that it appears again if i try to read the data from the NSMutableArray.

Please take a moment to check my project and help me, beacause i'm going crazy about that!!
abramodj is offline   Reply With Quote
Old 08-08-2010, 07:10 PM   #2 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Default

What's the rest of the error message, and where in the code does it crash? The error message should say what the object and selector are.

PS: your app delegate looks strange. Your init method doesn't call "self=[super init]", and it does a lot of work that is usually put in applicationDidFinishLaunching instead.

I believe the other issue is here:

Code:
		tempArray = [decoder decodeObjectForKey:@"smokeArray"];
		[self setSmokeArray:tempArray];
When you encode and then decode a NSMutableArray, you get a NSArray back. You probably fail when you try to send a method like "addObject:" to an array which is not mutable. You probably need this instead:

Code:
		tempArray = [[decoder decodeObjectForKey:@"smokeArray"] mutableCopy];
		[self setSmokeArray:tempArray];
__________________

Free Games!

Last edited by smasher; 08-08-2010 at 07:19 PM.
smasher is offline   Reply With Quote
Reply

Bookmarks

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 333
10 members and 323 guests
arash5500, HemiMG, iram91419, linkmx, mediaspree, Objective Zero, Paul Slocum, stanny, Touchmint, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,656
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, iram91419
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:34 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0