2012-01-23 78 views
0

我得到程序上的main.m接收信號「SIGABRT」程序接收到的信號「SIGABRT」

- (IBAction)segmentControl:(id)sender { 

    NSTimeInterval oneUnit=(60*60*24*3); 
    //NSTimeInterval oneUnit1=(60*60*24*60); 

    switch (self.ydm.selectedSegmentIndex) { 

     case 0: 
      for (i=0; i<([forex count]); i++) { //It does not go next step 
       NSTimeInterval x=oneUnit*i/2; 
       i++; 
       id y=[NSNumber numberWithFloat:[[forex objectAtIndex:i] floatValue]]; 
        [contentArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSDecimalNumber numberWithFloat:x],@"x",y,@"y", nil]]; 
        self.dataForPlot=contentArray; 
      } 
      break; 

     default: 
      break; 
} 

任何一個能幫助我嗎?

+0

做你試圖設置斷點,並檢查其它獲得SIGBART嗎? – Shubhank

+0

yes.for(i = 0; i <([forex count]); i ++)從它直接返回UIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegate class]))並顯示sigbrat錯誤 – Priya

+0

@ Priya,你如何創建數組*外匯*? – EmptyStack

回答

0

我想這個問題是因爲外匯。它似乎是autoreleased。確保它在您訪問時可用。您應該在創建它時保留。對這個問題的意見後

編輯:

只需更改線路,

forex=[(NSString *)[Global soapResults] componentsSeparatedByString:@","]; 

是這樣,

forex=[[(NSString *)[Global soapResults] componentsSeparatedByString:@","] retain]; 
+0

謝謝它幫助我。 – Priya

+0

不客氣! – EmptyStack

0

更新:試試這個第一

變化

case 0: 
     for (i=0; i<([forex count]); i++) { //It does not go next step 

case 0: 
     if(!forex) 
     { 
      NSLog(@"Here is my Error"); 
     for (i=0; i<([forex count]); i++) { //It does not go next step 

如果你得到的NSLog ..that是它沒有外匯。

變化

for (i=0; i<([forex count]); i++) 

for (int i=0; i<([forex count]); i++) 

,並再次嘗試..:d

+0

如果是這樣,那麼它不會編譯,更不用說運行。雖然我不知道'i'在代碼中被聲明的位置。 – mattjgalloway

+0

是啊...我知道...但仍然..只有兩個問題可以在那裏..我張貼一個答案,,和空堆棧張貼for other..let's看誰是對的??:D – Shubhank

+0

我不' t認爲*缺少int *是這裏的問題,因爲@Priya似乎在這裏鍵入了代碼,而不是從她的項目中複製。 – EmptyStack

相關問題