0

我的应用程序中有一个功能,每次用户在操作后点击“提交”按钮时,游戏都会检查该操作是否是 Game Center 中的成就。最近,该应用程序在一些有和没有连接的人(所有不同的 iPhone 型号、iPad 型号和 iOS 系统)中崩溃。从崩溃日志看来,这就是问题所在:

Incident Identifier: E44706D0-6B10-44DD-BDB2-EDCD563011DC
CrashReporter Key:   7580fe38161bf461fc45c8e5c4c5ab07747756be
Hardware Model:      iPhone5,2
Process:         APPNAME [1417]
Path:            /var/mobile/Applications/9B7EAD6C9-4A1F-4A46-84DE-762EDED1A1BD/APPNAME.app/APPNA
Identifier:      APPNAME
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2012-11-08 23:40:52.926 -0500
OS Version:      iOS 6.0.1 (10A525)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x3b3c03e2 0x3b2fe000 + 795618
1   libobjc.A.dylib                 0x3a41995e 0x3a411000 + 35166
2   CoreFoundation                  0x3b3c0302 0x3b2fe000 + 795394
3   CoreFoundation                  0x3b3103e6 0x3b2fe000 + 74726
4   APPNAME                     0x000f9950 -[Gamer updateCurrentAchievements:] (Gamer.m:621)
5   APPNAME                     0x000f9698 -[Gamer checkWord] (Gamer.m:560)
6   APPNAME                     0x000f8d22 -[Gamer ButtonPressed:] (Gamer.m:394)

这是它所指的代码块:

-(void) updateCurrentAchievements:(int) achievement_number
{
NSLog(@"Achievement Number is %d",achievement_number);
char ch = [ self.appDelegate.previous_Achieved characterAtIndex:achievement_number-1 ];
if( ch == '0' )
{
    currentAchieved[self.appDelegate.new_Achievements] = achievement_number;
    self.appDelegate.new_Achievements++;
    NSLog(@"new achievements are : %d",self.appDelegate.new_Achievements);
    self.appDelegate.current_Achieved = [self.appDelegate.current_Achieved stringByReplacingCharactersInRange:NSMakeRange((achievement_number-1), 1) withString:@"1"];
        self.appDelegate.previous_Achieved = self.appDelegate.current_Achieved;
        [self.appDelegate checkAchievements:achievement_number];
    }
    NSLog(@"current Achievement string is %@ and length is %d",self.appDelegate.current_Achieved,[self.appDelegate.current_Achieved length]);
}

有什么想法可能会在这里发生吗?任何见解都值得赞赏。如果我没有提供更多信息,我很抱歉,但请告诉我,我当然可以为您提供更多信息。谢谢!

4

1 回答 1

1

If achievement_number is 0 when starting the method, a SIGABRT will happen when this line is invoked:

self.appDelegate.current_Achieved = [self.appDelegate.current_Achieved stringByReplacingCharactersInRange:NSMakeRange((achievement_number-1), 1) withString:@"1"];

于 2012-11-09T22:27:51.180 回答