date pickerview経由でユーザーから開始日と終了日を取得しています。ユーザーがpickerviewをスピードでスクロールすると、そこでクラッシュし、この例外が表示されます。だから解決策は何ですか?「空の配列の境界を超えてインデックス0を超えています」という例外が発生していますか?
[
NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x013fabe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0154f5c2 objc_exception_throw + 47
2 CoreFoundation 0x013f06e5 -[__NSArrayM objectAtIndex:] + 261
3 iFeel 0x0001e1b7 -[S7GraphView drawRect:] + 5714
4 UIKit 0x0047d6eb -[UIView(CALayerDelegate) drawLayer:inContext:] + 426
5 QuartzCore 0x01f6f9e9 -[CALayer drawInContext:] + 143
6 QuartzCore 0x01f6f5ef _ZL16backing_callbackP9CGContextPv + 85
7 QuartzCore 0x01f6edea CABackingStoreUpdate + 2246
8 QuartzCore 0x01f6e134 -[CALayer _display] + 1085
9 QuartzCore 0x01f6dbe4 CALayerDisplayIfNeeded + 231
10 QuartzCore 0x01f6038b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 325
11 QuartzCore 0x01f600d0 _ZN2CA11Transaction6commitEv + 292
12 QuartzCore 0x01f907d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
13 CoreFoundation 0x013dbfbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
14 CoreFoundation 0x013710e7 __CFRunLoopDoObservers + 295
15 CoreFoundation 0x01339bd7 __CFRunLoopRun + 1575
16 CoreFoundation 0x01339240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x01339161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x019de268 GSEventRunModal + 217
19 GraphicsServices 0x019de32d GSEventRun + 115
20 UIKit 0x0045442e UIApplicationMain + 1160
21 iFeel 0x00002990 main + 102
22 iFeel 0x00002921 start + 53
)
terminate called after throwing an instance of 'NSException'
方法の@deepak、グレイディプレイヤー@が話していることはこれです:私は行って言ってボタンをクリックし
-(void)getGraphicalData{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//[NSThread sleepForTimeInterval:1];
self.friendBL = [[FriendBL alloc] init];
self.result = [self.friendBL getGraphicalData1:txtStartTime.text andTodate:txtEndTime.text];
if ([self.result isKindOfClass:[NSString class]]) {
UIAlertView * friendListAlertView = [[UIAlertView alloc] initWithTitle:@"Friend List" message:(NSString*) self.result delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[friendListAlertView show];
[friendListAlertView release];
}
else {
self.reportList = (NSMutableArray*) self.result;
NSLog(@"%d",[reportList count]);
}
[pool release];
}
日付を選択した後、これはコード
です-(IBAction)doneBtn{
[dateView setHidden:YES];
NSLog(@"%@",[dateTimePicker date]);
NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateStyle:NSDateFormatterBehaviorDefault];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy hh:mm:ss"];
dateFormat.locale = locale;
if (tag) {
txtEndTime.text=[dateFormat stringFromDate:[dateTimePicker date]];
if (![self compareDates]) {
[email protected]"";
[email protected]"";
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning!" message:@"Date is not in valid" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
else {
txtStartTime.text=[dateFormat stringFromDate:[dateTimePicker date]];
}
NSLog(@"%@",[dateFormat stringFromDate:[dateTimePicker date]]);
}
ただし、日付をゆっくりと選択するとクラッシュしません。
:-(助けるために私の最後の試みです:S7GraphView''の 'メソッドを、それがS7GraphViewからピッカービューをいない来ている –
、あなたは手渡ししなければなりませんいくつかのガベージデータがあります。 –
@Deepak、googlecodeでホストされているもの、http://code.google.com/p/s7graphview/ –