UIWebSelectSinglePicker崩溃

tzl*_*tzl 14 iphone objective-c uiwebview ios

我们收到一些关于崩溃的报告UIWebSelectSinglePicker.我们猜测这是由于数据源阵列空.这发生在webview中.我们如何解决这个问题?更喜欢原生的解决方案

编辑

仅在iphone上运行,同时运行iOS7和iOS8

1   CoreFoundation  __exceptionPreprocess + 127
2   libobjc.A.dylib objc_exception_throw + 36
3   CoreFoundation  -[__NSArrayM objectAtIndex:] + 228
4   UIKit   -[UIWebSelectSinglePicker pickerView:didSelectRow:inComponent:] + 56
5   UIKit   -[UIPickerView _sendSelectionChangedForComponent:notify:] + 90
6   UIKit   -[UIPickerTableView _scrollingFinished] + 152
7   UIKit   -[UIScrollView(UIScrollViewInternal) _stopScrollDecelerationNotify:] + 842
8   UIKit   -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 502
9   UIKit   -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:] + 28
10  UIKit   -[UIScrollView _smoothScrollWithUpdateTime:] + 208
11  QuartzCore  CA::Display::DisplayLinkItem::dispatch() + 96
12  QuartzCore  CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 364
13  IOMobileFramebuffer IOMobileFramebufferVsyncNotifyFunc + 88
14  IOKit   IODispatchCalloutFromCFMessage + 254
15  CoreFoundation  __CFMachPortPerform + 130
16  CoreFoundation  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
17  CoreFoundation  __CFRunLoopDoSource1 + 344
18  CoreFoundation  __CFRunLoopRun + 1606
19  CoreFoundation  CFRunLoopRunSpecific + 474
20  CoreFoundation  CFRunLoopRunInMode + 104
21  GraphicsServices    GSEventRunModal + 134
22  UIKit   UIApplicationMain + 1438
23  MYAPP   main (main.m:16)
24  libdyld.dylib   start + 0
Run Code Online (Sandbox Code Playgroud)

Y.B*_*ons 0

我认为与 没有联系UIWebSelectSinglePicker。我认为您正在尝试访问数组范围之外索引处的对象。

为了防止这种情况,你可以添加如下内容:

if(index < [self.myArray count] && [self.myArray count] > 0){
     id myobject = [self.myArray objectAtIndex:index];
     // do what you want here with your object
}
Run Code Online (Sandbox Code Playgroud)

要调试此类问题并找到发生的位置,请尝试添加符号断点:

  1. 选择断点导航器
  2. 点击“+”
  3. “添加符号断点”
  4. 在符号字段中添加“objectAtIndex”