ios - BUTTON SHAPE on in device (iPhone) setting result app crash if its off app working

标签 ios objective-c ios7.1 unrecognized-selector

最近我将我的应用程序切换到 iOS 7 兼容性并且应用程序工作正常但是如果我在设备设置(设置--> Accessblity--> 按钮形状开关)中打开按钮形状选项(在 iOS 7.1 中可用)然后应用程序崩溃并给出以下错误:-

-[NSAttributeDictionary textContainerForAttributedString:containerSize:lineFragmentPadding:]: 无法识别的选择器发送到实例 0x17e4e310 核心基础

当按钮形状选项关闭时,应用程序工作正常。

崩溃堆栈跟踪:-

-[NSAttributeDictionary textContainerForAttributedString:containerSize:lineFragmentPadding:]: unrecognized selector sent to instance 0x17e4e310
CoreFoundation

Occurrences7
Users2
#   Binary Image Name   Address Symbol
0   CoreFoundation  0x2f057f0b  
1   libobjc.A.dylib 0x397eece7  objc_exception_throw
2   CoreFoundation  0x2f05b837  
3   CoreFoundation  0x2f05a137  
4   CoreFoundation  0x2efa9098  _CF_forwarding_prep_0
5   UIFoundation    0x36cd7915  __NSStringDrawingEngine
6   UIFoundation    0x36cd4863  -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:]
7   UIKit   0x318a02c9  -[UILabel _drawTextInRect:baselineCalculationOnly:]
8   UIKit   0x31906709  -[UILabel drawTextInRect:]
9   UIKit   0x3190650b  -[UILabel drawRect:]
10  UIKit   0x319064a9  -[UIView(CALayerDelegate) drawLayer:inContext:]
11  QuartzCore  0x31532189  -[CALayer drawInContext:]
12  QuartzCore  0x3151bc5b  CABackingStoreUpdate_
13  QuartzCore  0x315f7c1d  ___ZN2CA5Layer8display_Ev_block_invoke
14  QuartzCore  0x3151b50b  x_blame_allocations
15  QuartzCore  0x3151b1bf  _ZN2CA5Layer8display_Ev
16  QuartzCore  0x314fed41  _ZN2CA5Layer17display_if_neededEPNS_11TransactionE
17  QuartzCore  0x314fe9d9  _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE
18  QuartzCore  0x314fe3e5  _ZN2CA7Context18commit_transactionEPNS_11TransactionE
19  QuartzCore  0x314fe1f7  _ZN2CA11Transaction6commitEv
20  QuartzCore  0x3152b8e3  _ZN2CA11Transaction14release_threadEPv
21  libsystem_pthread.dylib 0x39e096d1  
22  libsystem_pthread.dylib 0x39e09453  
23  libsystem_pthread.dylib 0x39e0a1b9  pthread_exit
24  Foundation  0x2f994703  +[NSThread exit]
25  Foundation  0x2fa40a2d  __NSThread__main__
26  libsystem_pthread.dylib 0x39e0a959  
27  libsystem_pthread.dylib 0x39e0a8cb  _pthread_start
28  libsystem_pthread.dylib 0x39e08ae8  thread_start

任何建议 谢谢

最佳答案

这通常是由于 iOS 7.1 中某些代码的不兼容而导致的。

这一定是在设备中发生的,而不是在模拟器中发生的。对吧?

Simulator 在不同硬件(底层 Mac OS)和设备硬件上运行这一事实可能意味着偶尔会存在一些类似的差异。

你可以做的是放置一个“异常断点”来找出是哪个方法给出了这个错误。获取方法后,您需要做的就是在主线程中调用该方法。

你可以使用:

dispatch_async(dispatch_get_main_queue(), ^{
  [self doSomething];
});

这应该可以解决问题。希望这可以帮助。谢谢。 :)

关于ios - BUTTON SHAPE on in device (iPhone) setting result app crash if its off app working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23949168/

相关文章:

iphone - 设置 UIButton 字体

ios - AppDelegate中的NSTimer从不触发

ios - 在 iOS7.1 中转换 UIImageView 时如何去除无意的垂直线

ios - Xcode beta 7.0 无法链接到 unwind segue

iphone - 为 UITableView 设置三边边框 - IOS

ios - 企业 IPA 文件的最大限制(内部)?

ios - 如何使用 Obj-C 在 iOS 中播放 mp3

iphone - 如何在音乐播放器中设置音乐播放 slider

iphone - UITextAttributeTextShadowOffset 已弃用

ios - 相机不聚焦在运行 iOS 7.1 的 iPhone 4 上