MPMoviePlayerController can't play playlists and video from documents folder - iphone

My app has video content in documents folder
/playlists/ - it's playlists folder i use m3u format.
/videoContent/ - it's videos folder.
FIRST.
And when i run player with code for load playlist and content from server
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:#"http://mbp.local/rat/playlists/Playlist.a60df6084e7d38b12f84afc602bb39ef.m3u"]];
m3u
#EXTM3U
#EXTINF:3000,abc
http://mbp.local/rat/videoContent/1.82aa02198c0255eddc1e538c184c176b.mov
#EXTINF:3111,cab
http://mbp.local/rat/videoContent/9.4e574f9485a9031c536425b7f79ef545.mp4
Thats not works with message in log:
2014-01-11 04:06:04.573 RAT[736:70b] Internal Log: Video playing
2014-01-11 04:06:04.606 RAT[736:70b] Internal Log: Video paused
2014-01-11 04:06:04.615 RAT[736:70b] Internal Log: Video playing
2014-01-11 04:06:04.680 RAT[736:70b] _itemFailedToPlayToEnd: {
kind = 1;
new = 2;
old = 0;
}
2014-01-11 04:06:04.683 RAT[736:70b] Internal Log: Video stopped
2014-01-11 04:06:04.688 RAT[736:70b] Internal Log: Video stopped
SECOND
When i try play playlist from documents folder.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[NSString stringWithFormat: #"%#/playlists/Playlist.a60df6084e7d38b12f84afc602bb39ef.m3u",documentsFolderPath]]];
m3u with relative paths as described in specification.
#EXTM3U
#EXTINF:3000,abc
../videoContent/1.82aa02198c0255eddc1e538c184c176b.mov
#EXTINF:3111,cab
../videoContent/9.4e574f9485a9031c536425b7f79ef545.mp4
Then i see some log message as in first try.
THIRD
Play playlist from documents folder, and play list contains full path.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[NSString stringWithFormat: #"%#/playlists/Playlist.a60df6084e7d38b12f84afc602bb39ef.m3u",documentsFolderPath]]];
m3u
#EXTM3U
#EXTINF:3000,abc
/Users/royalblue/Library/Application Support/iPhone Simulator/7.0.3/Applications/96C671E3-EE7F-484E-A548-846E4D917CDD/Documents/videoContent/1.82aa02198c0255eddc1e538c184c176b.mov
#EXTINF:3111,cab
/Users/royalblue/Library/Application Support/iPhone Simulator/7.0.3/Applications/96C671E3-EE7F-484E-A548-846E4D917CDD/Documents/videoContent/9.4e574f9485a9031c536425b7f79ef545.mp4
LOG
2014-01-11 04:09:11.220 RAT[788:70b] Internal Log: Video playing
2014-01-11 04:09:11.241 RAT[788:70b] Internal Log: Video paused
2014-01-11 04:09:11.247 RAT[788:70b] Internal Log: Video playing
2014-01-11 04:09:11.254 RAT[788:70b] Internal Log: Video stopped
2014-01-11 04:09:11.308 RAT[788:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An AVPlayerItem cannot be associated with more than one instance of AVPlayer'
*** First throw call stack:
(
0 CoreFoundation 0x01ed05e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018768b6 objc_exception_throw + 44
2 AVFoundation 0x00161101 -[AVPlayerItem _attachToFigPlayer] + 0
3 AVFoundation 0x00152ebb -[AVPlayer _attachItem:andPerformOperation:withObject:] + 286
4 AVFoundation 0x00151eb3 -[AVPlayer _insertItem:afterItem:] + 55
5 AVFoundation 0x001726fe -[AVQueuePlayer insertItem:afterItem:] + 148
6 MediaPlayer 0x01b88c53 -[MPQueuePlayer insertItem:afterItem:] + 68
7 MediaPlayer 0x01b6367e __89-[MPAVQueuePlayerFeeder _updatePlayerQueueWithRemovedItems:addedItems:removeCurrentItem:]_block_invoke382 + 890
8 libdispatch.dylib 0x0216a7f8 _dispatch_call_block_and_release + 15
9 libdispatch.dylib 0x0217f4b0 _dispatch_client_callout + 14
10 libdispatch.dylib 0x0216d75e _dispatch_main_queue_callback_4CF + 340
11 CoreFoundation 0x01f35a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
12 CoreFoundation 0x01e766bb __CFRunLoopRun + 1963
13 CoreFoundation 0x01e75ac3 CFRunLoopRunSpecific + 467
14 CoreFoundation 0x01e758db CFRunLoopRunInMode + 123
15 GraphicsServices 0x027f89e2 GSEventRunModal + 192
16 GraphicsServices 0x027f8809 GSEventRun + 104
17 UIKit 0x005e4d3b UIApplicationMain + 1225
18 RAT 0x0000cfad main + 141
19 libdyld.dylib 0x0241170d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
But if i play video directly from folder or server without playlist - all fine.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[NSString stringWithFormat: #"%#/videoContent/1.82aa02198c0255eddc1e538c184c176b.mov",documentsFolderPath]]];
And if i play playlist from external video streaming server with m3u-all fine too.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:#"http://devimages.apple.com/iphone/samples/bipbop/gear3/prog_index.m3u8"]];
Whats happend? I don't know.

Had same issue, try setting ContentURL after Setting the SourceType like below,
moviePlayerController_ = [[MPMoviePlayerViewController alloc] init];
moviePlayerController_.movieSourceType = MPMovieSourceTypeStreaming;
[moviePlayerController_.moviePlayer setContentURL:url];
Source: devforums.apple.com/message/467199
Hope it helps

// You've already got the full path to the documents directory here.
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:#"/one.mp4"];
// Now you're appending the full path to the documents directory to your bundle path
NSString *mediaPath = [[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:filePath];
And then change your player instantiation to this:
_moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:filePath]];
[[_moviePlayer view] setFrame:[[self view] bounds]];
[[self view] addSubview: [_moviePlayer view]];
_moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
[_moviePlayer play];

Related

Could the following code produce a crash on older devices?

I have this bit of code relating to my in app purchases for an SKProductRequest:
SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:...
request.delegate = self;
[request start];
[request release];
One of my users is getting a crash on an iPod4 and I think it might be from this, however, all other devices are able to run this code OK. Should request be saved in a property while its loading, could that be the issue? I would think with [request start], that request would be retained somewhere else.
Here is the crash log:
Last Exception Backtrace:
0 CoreFoundation 0x3275229e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3a3c597a objc_exception_throw + 26
2 CoreFoundation 0x3269ce88 -[__NSArrayI objectAtIndex:] + 160
3 AppsHappens Lite 0x000e43ac 0xd8000 + 50092
4 StoreKit 0x3450c22e __34-[SKProductsRequest _handleReply:]_block_invoke_0 + 378
5 libdispatch.dylib 0x3a7dd11a _dispatch_call_block_and_release + 6
6 libdispatch.dylib 0x3a7dc4b2 _dispatch_client_callout + 18
7 libdispatch.dylib 0x3a7dddc6 _dispatch_main_queue_callback_4CF$VARIANT$up + 222
8 CoreFoundation 0x32725f36 __CFRunLoopRun + 1286
9 CoreFoundation 0x32698eb8 CFRunLoopRunSpecific + 352
10 CoreFoundation 0x32698d44 CFRunLoopRunInMode + 100
11 GraphicsServices 0x362492e6 GSEventRunModal + 70
12 UIKit 0x345ae2fc UIApplicationMain + 1116
13 AppsHappens Lite 0x000e3a8e 0xd8000 + 47758
14 AppsHappens Lite 0x000dadb4 0xd8000 + 11700
Updated: A lot of folks below are saying that it's an array out of bounds error and I think they're right. Strange thing is though, it appears the product request is coming back successfully, and it's called ing [self loadFullVersionPrice] which simply extracts the price for one of my products. When it tries to retrieve the Full Version product from the products array, I think that's when it crashes. Is it possible the app store would only return some of my products and not all of them? Or some issue with an iPod4?
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
self.products = response.products;
if (self.products)
{
[self loadFullVersionPrice];
}
}
- (void) loadFullVersionPrice
{
SKProduct *product = [[self.products objectAtIndex:[self.products count]-1] retain];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[numberFormatter setLocale:product.priceLocale];
self.fullVersionPrice = [numberFormatter stringFromNumber:product.price];
[numberFormatter release];
[product release];
}
Also, the iPod Touch 4 in question is jail broken.
Three reasons why this was occurring:
1) The user was on a jail broken phone
2) The version of my app he was installing was an ad hoc release
3) He was trying to access in app purchase
Apparently, jail broken phones are unable to access the sandbox (which is accessed when you try to do an app purchase on an ad hoc distribution).

Issues with playing Audio (mp3) on Xcode

I have the following problem on my application. When I press the Play button, the mp3 starts playing and also terminates the application.
SongDetailsViewController.h
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#interface SongDetailsViewController : UIViewController <AVAudioPlayerDelegate> {
AVAudioPlayer *player;
NSString *songID;
NSString *species;
}
- (void) dismissModal:(id)sender;
- (IBAction) playCall:(id)sender;
- (IBAction) pauseCall:(id)sender;
- (IBAction) stopCall:(id)sender;
#property (nonatomic, retain) AVAudioPlayer *player;
#property (nonatomic, copy) NSString *songID;
#property (nonatomic, copy) NSString *species;
#end
And SongDetailsViewController.m
- (IBAction) pauseCall:(id)sender{
[player pause];
}
- (IBAction) stopCall:(id)sender
{
[player stop];
}
- (IBAction) playCall:(id)sender{
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString *songPath = [documentsDir stringByAppendingPathComponent:#"songs"];
NSString *mySongPath = [songPath stringByAppendingPathComponent:[songID stringByAppendingString:#".mp3"]];
NSURL *file = [[NSURL alloc] initFileURLWithPath:mySongPath];
player = [[AVAudioPlayer alloc] initWithContentsOfURL:file error:nil];
player.delegate=self;
[player prepareToPlay];
[player play];
}
Error Stack.
2011-12-29 20:04:40.508 Bird Call Player[6266:307] -[SongDetailsViewController playNote:]: unrecognized selector sent to instance 0x1bcdb0
2011-12-29 20:04:40.531 Bird Call Player[6266:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SongDetailsViewController playNote:]: unrecognized selector sent to instance 0x1bcdb0'
*** Call stack at first throw:
(
0 CoreFoundation 0x344aaed3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x33975811 objc_exception_throw + 24
2 CoreFoundation 0x344ac683 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x344541d9 ___forwarding___ + 508
4 CoreFoundation 0x34453f90 _CF_forwarding_prep_0 + 48
5 CoreFoundation 0x34452719 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
6 UIKit 0x31b30141 -[UIApplication sendAction:to:from:forEvent:] + 84
7 UIKit 0x31b300e1 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
8 UIKit 0x31b300b3 -[UIControl sendAction:to:forEvent:] + 38
9 UIKit 0x31b2fe05 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
10 UIKit 0x31b30453 -[UIControl touchesEnded:withEvent:] + 342
11 UIKit 0x31b2eddd -[UIWindow _sendTouchesForEvent:] + 368
12 UIKit 0x31b2e757 -[UIWindow sendEvent:] + 262
13 UIKit 0x31b299ff -[UIApplication sendEvent:] + 298
14 UIKit 0x31b29337 _UIApplicationHandleEvent + 5110
15 GraphicsServices 0x3026c04b PurpleEventCallback + 666
16 CoreFoundation 0x3443fce3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
17 CoreFoundation 0x3443fca7 __CFRunLoopDoSource1 + 166
18 CoreFoundation 0x3443256d __CFRunLoopRun + 520
19 CoreFoundation 0x34432277 CFRunLoopRunSpecific + 230
20 CoreFoundation 0x3443217f CFRunLoopRunInMode + 58
21 GraphicsServices 0x3026b5f3 GSEventRunModal + 114
22 GraphicsServices 0x3026b69f GSEventRun + 62
23 UIKit 0x31ad0123 -[UIApplication _run] + 402
24 UIKit 0x31ace12f UIApplicationMain + 670
25 Bird Call Player 0x000026cb main + 122
26 Bird Call Player 0x00002114 start + 40
)
terminate called after throwing an instance of 'NSException'
If I move the code inside the playCall into the initWithNibName it works fine. Can someone help me to figure out what is the mistake I have done?
Thanking you in advance
reason: '-[SongDetailsViewController playNote:]: unrecognized selector sent to instance 0x1bcdb0'
in xib did you set your playCall IBAction to your button play or there is another action name?

Accelerometer - Crashing after shaken - Cocoa Touch

Hello
I'm trying to have it, so once the user shakes the device. I want a sound to play. However once I shake the device it crashes, this is the code which I have used
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self becomeFirstResponder];
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if(motion == UIEventSubtypeMotionShake)
{
NSString *path = [[NSBundle mainBundle] pathForResource:#"sound" ofType:#"wav"];
if (theAudio) [theAudio release];
NSError *error = nil;
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error];
if (error)
NSLog(#"%#",[error localizedDescription]);
theAudio.delegate = self;
[theAudio play];
}
}
And this is the crash report
2011-04-19 19:25:44.337 iApp[314:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fc3be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00db85c2 objc_exception_throw + 47
2 CoreFoundation 0x00f7c628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00f7c59a +[NSException raise:format:] + 58
4 Foundation 0x00055b12 -[NSURL(NSURL) initFileURLWithPath:] + 90
5 Foundation 0x00055aa0 +[NSURL(NSURL) fileURLWithPath:] + 72
6 iApp 0x0000305d -[AppViewController motionEnded:withEvent:] + 256
7 UIKit 0x002dc07c -[UIWindow sendEvent:] + 350
8 UIKit 0x002bf37a -[UIApplication sendEvent:] + 447
9 UIKit 0x002c311b _UIApplicationHandleEvent + 1921
10 GraphicsServices 0x017daa36 PurpleEventCallback + 1550
11 CoreFoundation 0x00fa5064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
12 CoreFoundation 0x00f056f7 __CFRunLoopDoSource1 + 215
13 CoreFoundation 0x00f02983 __CFRunLoopRun + 979
14 CoreFoundation 0x00f02240 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x00f02161 CFRunLoopRunInMode + 97
16 GraphicsServices 0x017d9268 GSEventRunModal + 217
17 GraphicsServices 0x017d932d GSEventRun + 115
18 UIKit 0x002c842e UIApplicationMain + 1160
19 iApp 0x0000295c main + 102
20 iApp 0x000028ed start + 53
)
terminate called after throwing an instance of 'NSException'
Given the crash report reason:
reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
along with the last executed line in your app's code:
6 iApp 0x0000305d -[AppViewController motionEnded:withEvent:] + 256
I would think that your sound.wav file is missing:
NSString *path = [[NSBundle mainBundle] pathForResource:#"sound" ofType:#"wav"];
I suggest your make sure:
the sound.wav file is in your project
is case sensitively spelled "sound.wav"
Hope this helps.

iPhone app crashes if view is swapped during data download

I have an iphone app that when the user clicks a row in a uitable, it takes the row value and downloads some data from the web to populate the next view. However if the user switches back to the first view when the data is being downloaded the app crashes. I think i've found the problem but need some help fixing it:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSManagedObject *selectedObject = [[self fetchedResultsController] objectAtIndexPath:indexPath];
BlogRssParser *blogRss = [[BlogRssParser alloc] init];
blogRss.terms = [[selectedObject valueForKey:#"data"] description];
RssFunViewController *rssFun = [[RssFunViewController alloc] initWithNibName:#"RssFunViewController" bundle:nil];
rssFun.rssParser = blogRss;
[blogRss release];
[self.navigationController pushViewController:rssFun animated:YES];
rssFun.navigationItem.title=blogRss.terms;
[rssFun release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
So where it says [self.navigationController pushViewController:rssFun animated:YES]; this is where it crashes because once it finishes the download this is the next line of code and it can push a view if its not on the right screen if that makes any sense!? Thanks for any advice anyway!
BlogRssParser:
-(BOOL)fetchAndParseRss{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
//To suppress the leak in NSXMLParser
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSString *urlTerm = terms;
urlTerm = [urlTerm stringByReplacingOccurrencesOfString:#" " withString:#"+"];
urlTerm = [urlTerm stringByReplacingOccurrencesOfString:#"\t" withString:#""];
urlTerm = [urlTerm stringByReplacingOccurrencesOfString:#"&" withString:#""];
urlTerm = [urlTerm stringByReplacingOccurrencesOfString:#"'" withString:#""];
urlTerm = [urlTerm stringByReplacingOccurrencesOfString:#"-" withString:#""];
urlTerm = [urlTerm stringByReplacingOccurrencesOfString:#"_" withString:#""];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:#"xxxxxxxxxxxxx/app.php?s=%#", urlTerm]];
NSLog(#"%#", url);
BOOL success = NO;
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser setShouldProcessNamespaces:YES];
[parser setShouldReportNamespacePrefixes:YES];
[parser setShouldResolveExternalEntities:NO];
success = [parser parse];
[parser release];
[pool drain];
return success;
}
Console:
2010-12-06 19:15:09.826 Example[452:207] -[NSCFString processCompleted]: unrecognized selector sent to instance 0x6123d30
2010-12-06 19:15:09.855 Example[452:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString processCompleted]: unrecognized selector sent to instance 0x6123d30'
*** Call stack at first throw:
(
0 CoreFoundation 0x02664b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x027b440e objc_exception_throw + 47
2 CoreFoundation 0x026666ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x025d62b6 ___forwarding___ + 966
4 CoreFoundation 0x025d5e72 _CF_forwarding_prep_0 + 50
5 Foundation 0x000423ca __NSThreadPerformPerform + 251
6 CoreFoundation 0x02645faf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
7 CoreFoundation 0x025a439b __CFRunLoopDoSources0 + 571
8 CoreFoundation 0x025a3896 __CFRunLoopRun + 470
9 CoreFoundation 0x025a3350 CFRunLoopRunSpecific + 208
10 CoreFoundation 0x025a3271 CFRunLoopRunInMode + 97
11 GraphicsServices 0x02f4300c GSEventRunModal + 217
12 GraphicsServices 0x02f430d1 GSEventRun + 115
13 UIKit 0x002d1af2 UIApplicationMain + 1160
14 Example 0x0000244a main + 84
15 Example 0x000023ed start + 53
)
terminate called after throwing an instance of 'NSException'
unrecognized selector means that you've attempted to send a message to an object that doesn't know how to handle it.
For example, suppose you had a class AlienParser and it had two methods: land and probe. You create an instance of it called myParser, and then tried to call [myParser destroyAllHumans]. The resulting object wouldn't know what to do, and you'd get an exception thrown. It compiles because you can send any message to anything with Obj-C, because at runtime it may know how to handle it even if the compiler couldn't detect so.
Somewhere (the hex is your clue, it doesn't show a full backtrace) you've got some code calling another object with a message it just plain doesn't support. It's probably worth mentioning that ANY message to nil does nothing and returns nil so you've obviously got an actual object there you are sending messages to.
Have you tried downloading the XML in a background thread? This may alleviate some of the issues as the main thread won't be blocked. You should be able to push on the RssFunViewController while the XML is/being downloaded.

iPad app works on most devices, gets EXC_CRASH (SIGABRT) on some

I created this awesome iPad game - clean and fun to play, and people that manage to play it more than once love it.
In some cases, however, it will not launch for the second time.
I can't debug it since it works perfect on my iPad, simulator and on all my friend's iPads.
One customer told me that it works on 32GB but not on 64GB iPads - could this be it?
Any help would be appreciated - this is sinking my ratings (and for a good reason, unfortunately)
Would love to give out promo code to anyone willing to look into this.
Thanks!!
Hanaan
From My AppDelegate, if helps:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.playerName = [[NSUserDefaults standardUserDefaults] objectForKey:#"player_name"];
if(self.playerName == nil){
self.playerName = #"nono";
self.pref_currentPuzzleNumberHintsString = #"";
self.pref_currentPuzzleFinishedSolutionString = #"";
self.pref_currentPlayerMarksString = #"";
self.pref_marksCompleteString = #"";
self.pref_currentPuzzleId = -1;
self.pref_gameInProgress = NO;
self.pref_soundOn = YES;
self.pref_buttonsOnLeft = NO;
self.pref_gameTimerValue = 0;
self.pref_gameSize = 0;
NSNumber *pref_gameInProgress_temp = [NSNumber numberWithInt:0];
NSNumber *pref_soundOn_temp = [NSNumber numberWithInt:1];
NSNumber *pref_buttonsOnLeft_temp = [NSNumber numberWithInt:0];
NSNumber *pref_gameNumber_temp = [NSNumber numberWithInt:self.pref_currentPuzzleId];
NSNumber *pref_gameSize_temp = [NSNumber numberWithInt:self.pref_gameSize];
NSNumber *pref_gameTimer_temp = [NSNumber numberWithInt:self.pref_gameTimerValue];
NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
[standardUserDefaults setObject:self.pref_currentPuzzleFinishedSolutionString forKey:#"game_string"];
[standardUserDefaults setObject:self.pref_currentPuzzleNumberHintsString forKey:#"hint_string"];
[standardUserDefaults setObject:self.pref_currentPlayerMarksString forKey:#"solution_string"];
[standardUserDefaults setObject:self.pref_marksCompleteString forKey:#"marks_complete_string"];
[standardUserDefaults setObject:pref_gameNumber_temp forKey:#"game_id"];
[standardUserDefaults setObject:pref_gameSize_temp forKey:#"game_size"];
[standardUserDefaults setObject:pref_gameTimer_temp forKey:#"game_timer_value"];
[standardUserDefaults setObject:pref_gameInProgress_temp forKey:#"game_in_progress"];
[standardUserDefaults setObject:pref_soundOn_temp forKey:#"sound_on"];
[standardUserDefaults setObject:pref_buttonsOnLeft_temp forKey:#"buttons_on_left"];
[standardUserDefaults setObject:self.playerName forKey:#"player_name"];
[[NSUserDefaults standardUserDefaults] synchronize];
[pref_gameInProgress_temp release];
[pref_gameSize_temp release];
[pref_soundOn_temp release];
[pref_gameTimer_temp release];
[pref_gameNumber_temp release];
[pref_buttonsOnLeft_temp release];
}else {
self.pref_currentPlayerMarksString = [[NSUserDefaults standardUserDefaults] objectForKey:#"game_string"];
self.pref_currentPuzzleNumberHintsString = [[NSUserDefaults standardUserDefaults] objectForKey:#"hint_string"];
self.pref_currentPuzzleFinishedSolutionString = [[NSUserDefaults standardUserDefaults] objectForKey:#"solution_string"];
self.pref_marksCompleteString = [[NSUserDefaults standardUserDefaults] objectForKey:#"marks_complete_string"];
self.pref_currentPuzzleId = [[[NSUserDefaults standardUserDefaults] objectForKey:#"game_id"]intValue];
self.pref_gameSize = [[[NSUserDefaults standardUserDefaults] objectForKey:#"game_size"]intValue];
self.pref_gameTimerValue = [[[NSUserDefaults standardUserDefaults] objectForKey:#"game_timer_value"]intValue];
int pref_gameInProgress_temp = [[[NSUserDefaults standardUserDefaults] objectForKey:#"game_in_progress"]intValue];
self.pref_gameInProgress = (pref_gameInProgress_temp == 1);
int pref_soundOn_temp = [[[NSUserDefaults standardUserDefaults] objectForKey:#"sound_on"]intValue];
self.pref_soundOn = (pref_soundOn_temp == 1);
int pref_buttonsOnLeft_temp = [[[NSUserDefaults standardUserDefaults] objectForKey:#"buttons_on_left"]intValue];
self.pref_buttonsOnLeft = (pref_buttonsOnLeft_temp == 1);
//NSLog(#"Saved game: %#",self.pref_currentPlayerMarksString);
}
// Add the view controller's view to the window and display.
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
The log I got from a customer has this:
--
Incident Identifier: 1581089C-C02A-4155-9493-9E42B9AAB37D
CrashReporter Key: a913e5f82c7112b47b354f04909239bff1b39000
Hardware Model: iPad1,1
Process: Nonograms [193]
Path: /var/mobile/Applications/4F03245E-CFB8-4181-B881-859FDAEE18C7/Nonograms.app/Nonograms
Identifier: Nonograms
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2010-08-21 16:31:11.002 +0200
OS Version: iPhone OS 3.2.2 (7B500)
Report Version: 104
SYMBOLIZED:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x000790a0 __kill + 8
1 libSystem.B.dylib 0x00079090 kill + 4
2 libSystem.B.dylib 0x00079082 raise + 10
3 libSystem.B.dylib 0x0008d20a abort + 50
4 libstdc++.6.dylib 0x00044a1c __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x000057c4 _objc_terminate + 104
6 libstdc++.6.dylib 0x00042dee __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x00042e42 std::terminate() + 10
8 libstdc++.6.dylib 0x00042f12 __cxa_throw + 78
9 libobjc.A.dylib 0x000046a4 objc_exception_throw + 64
10 CoreFoundation 0x00094174 -[NSObject doesNotRecognizeSelector:] + 108
11 CoreFoundation 0x00093afa ___forwarding___ + 482
12 CoreFoundation 0x000306c8 _CF_forwarding_prep_0 + 40
13 Nonograms 0x00003238 0x1000 + 8760
14 UIKit 0x00003e58 -[UIApplication _performInitializationWithURL:payload:] + 336
15 UIKit 0x00003b22 -[UIApplication _runWithURL:payload:launchOrientation:] + 394
16 UIKit 0x0004f8c4 -[UIApplication handleEvent:withNewEvent:] + 1336
17 UIKit 0x0004f242 -[UIApplication sendEvent:] + 38
18 UIKit 0x0004ec8c _UIApplicationHandleEvent + 4772
19 GraphicsServices 0x00003b2c PurpleEventCallback + 660
20 CoreFoundation 0x00022d96 CFRunLoopRunSpecific + 2214
21 CoreFoundation 0x000224da CFRunLoopRunInMode + 42
22 UIKit 0x0000340a -[UIApplication _run] + 342
23 UIKit 0x00001954 UIApplicationMain + 636
24 Nonograms 0x00002538 0x1000 + 5432
25 Nonograms 0x00002508 0x1000 + 5384
You need to find the line of code that frame 13 of your stack trace represents.
I would hope that you used the "Build and Archive" feature of the recent versions of Xcode. In this case, all you would need to do is drag and drop the crash log to the Xcode Organizer. This will "symbolicate" the crash log, meaning that it will convert the addresses to classes and methods.
Once you know the line that caused the error it will (hopefully) be relatively simple to figure out what went wrong. My guess would be memory corruption of some description -- a value you assumed you saved on the first run isn't there or something.
I think some object or UI element of yours is getting released (deallocated), but you expect it to still exist:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/51235-crash-log-help.html
The problem was releasing unowned objects...
[pref_gameInProgress_temp release];
[pref_gameSize_temp release];
[pref_soundOn_temp release];
[pref_gameTimer_temp release];
[pref_gameNumber_temp release];
[pref_buttonsOnLeft_temp release];
I dont know the specifics of the iPad and obj-c development.
However, this looks like memory corruption and/or dangling pointers in some way.
For example, you could be modifying an array beyond its bounds. Double check all your loops and add debug asserts that verify the bounds.
Another possibility is that you could be using pointers to objects that have been deleted, and writing/interpreting this memory has undefined effects. Usually it just crashes.
Or you could have uninitialized pointers.
All of this falls into the category that I like to call The Insanity of Developing Applications in C/C++/etc. Unchecked buffer bounds, manual memory deallocation, and unguarded call stack memory are just nutty ideas w/r to modern application development.