仅在运行iOS 8的xcode 8上运行EXC_BAD_ACCESS [英] EXC_BAD_ACCESS only on xcode 8 running iOS 8

查看:546
本文介绍了仅在运行iOS 8的xcode 8上运行EXC_BAD_ACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从iOS 8到10的xcode 7编译时,应用程序运行正常但是从xcode 8编译时,应用程序仅在iOS 8上的iOS 9和10上正常运行,应用程序崩溃不一致。有时它会停在一个随机的UI元素,例如:

The app runs fine when compiled from xcode 7 for iOS 8 through 10 but when compiled from xcode 8, the app only works normally on iOS 9 and 10 on iOS 8, the app crashes inconsistently. Sometimes it will stop at a random UI element such as:

但更常见的是它会在主要崩溃:

But more often it will just crash at main:

* thread #1: tid = 0x11d655, 0x35deaf56 libobjc.A.dylib`objc_msgSend + 22, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xf632d5c1)
frame #0: 0x35deaf56 libobjc.A.dylib`objc_msgSend + 22
frame #1: 0x2db167ea CoreUI`-[CUINamedImage initWithName:usingRenditionKey:fromTheme:] + 98
frame #2: 0x2db21d48 CoreUI`-[CUICatalog imageWithName:scaleFactor:deviceIdiom:deviceSubtype:sizeClassHorizontal:sizeClassVertical:] + 128
frame #3: 0x2b8aee98 UIKit`__98-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:]_block_invoke + 240
frame #4: 0x2b8aecea UIKit`-[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:sizeClassPair:attachCatalogImage:] + 230
frame #5: 0x2b95df86 UIKit`-[UIImageAsset imageWithTraitCollection:] + 474
frame #6: 0x2b58d9d2 UIKit`-[UIImageView _resolveImageForTrait:] + 286
frame #7: 0x2b58d690 UIKit`-[UIImageView _didMoveFromWindow:toWindow:] + 156
frame #8: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #9: 0x2b300d50 UIKit`-[UIControl _didMoveFromWindow:toWindow:] + 44
frame #10: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #11: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #12: 0x2b28aef4 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 656
frame #13: 0x2b28a804 UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
frame #14: 0x2b28a720 UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 428
frame #15: 0x2b294bce UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1462
frame #16: 0x2b29460e UIKit`-[UIView(Hierarchy) addSubview:] + 30
frame #17: 0x2b459eae UIKit`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1262
frame #18: 0x2b29ada4 UIKit`+[UIView(Animation) performWithoutAnimation:] + 72
frame #19: 0x2b45977c UIKit`-[_UINavigationParallaxTransition animateTransition:] + 812
frame #20: 0x2b417cfc UIKit`-[UINavigationController _startCustomTransition:] + 2860
frame #21: 0x2b337026 UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 422
frame #22: 0x2b336e2c UIKit`-[UINavigationController __viewWillLayoutSubviews] + 44
frame #23: 0x2b336dc0 UIKit`-[UILayoutContainerView layoutSubviews] + 184
frame #24: 0x2b28b7fe UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 514
frame #25: 0x2acb1834 QuartzCore`-[CALayer layoutSublayers] + 136
frame #26: 0x2acad20c QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 360
frame #27: 0x2acad094 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
frame #28: 0x2acaca70 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 224
frame #29: 0x2acac874 QuartzCore`CA::Transaction::commit() + 324
frame #30: 0x2aca674c QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 56
frame #31: 0x27d37ffc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
frame #32: 0x27d356ba CoreFoundation`__CFRunLoopDoObservers + 278
frame #33: 0x27d35ac2 CoreFoundation`__CFRunLoopRun + 914
frame #34: 0x27c833b0 CoreFoundation`CFRunLoopRunSpecific + 476
frame #35: 0x27c831c2 CoreFoundation`CFRunLoopRunInMode + 106
frame #36: 0x2f1f2200 GraphicsServices`GSEventRunModal + 136
frame #37: 0x2b2ed43c UIKit`UIApplicationMain + 1440
* frame #38: 0x0017bf62 Dev`main(argc=1, argv=0x01549a28) + 106 at main.m:14
frame #39: 0x3636aaae libdyld.dylib`start + 2

我已经启用了NSZombies并且我没有获得任何新信息。我也尝试打开地址消毒剂,它也会偶尔崩溃,但通常也会在主要方法中崩溃:

I already have NSZombies enabled and I have gotten no new information. I have also tried turning on the address sanitizer and it will also crash sporadically but usually also at the main method:

thread #1: tid = 0x11d992, 0x020fce9e libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie(), queue = 'com.apple.main-thread', stop reason = Attempt to free a non-allocated address
{
"access_size" : 0,
  "access_type" : 0,
  "address" : 103442256,
  "description" : "Attempt to free a non-allocated address",
  "instrumentation_class" : "AddressSanitizer",
  "pc" : 0,
  "stop_type" : "fatal_error"
}

从Xcode 7构建时,应用程序再次正常运行来自Xcode 8 for iOS 9或10.这只发生在从Xcode 8 for iOS 8构建时。任何想法?

Again the app works fine when built from Xcode 7 or from Xcode 8 for iOS 9 or 10. This only happens when built from Xcode 8 for iOS 8. Any ideas?

推荐答案

S ome团队中的其他人找到了答案。 Bogus。

Some other guy on the team found the answer. Bogus.

https:// forums。 developer.apple.com/thread/60919


使用Xcode 8 GM,如果包含16位,则会出现此错误应用程序提交中的P3或b
资产,其目标是早于iOS
9.3的iOS版本。如果您的应用需要广泛的颜色功能,则必须将部署目标更改为iOS 9.3或更高版本。如果您的应用程序不是
需要广泛的颜色功能,并且您希望将其部署到较旧的
iOS版本,那么您应该用
8位sRGB资产替换所有16位或P3资产。您可以通过在
iTunes Connect的错误消息中指定的资产目录上运行
assetutil来查找16位或P3资产。以下步骤概述了该过程:

With Xcode 8 GM, this error will occur if you include 16-bit or P3 assets in an app submission targeting iOS releases earlier then iOS 9.3. If your app requires wide color functionality you must change your Deployment Target to iOS 9.3 or later. If your app does not require wide color functionality and you wish to deploy it to older iOS versions then you should replace all 16-bit or P3 assets with 8-bit sRGB assets. You can find 16-bit or P3 assets by running "assetutil" on the asset catalog named in the error message from iTunes Connect. The following steps outline the process:


  1. 创建一个Inspectable .ipa文件。在Xcode Organizer(Xcode-> Window-> Organizer)中,选择要检查的存档,单击
    Export ...,然后选择Export for Enterprise或Ad-Hoc Deployment。
    将为您的应用创建.ipa文件的本地副本。

  2. 找到该.ipa文件并将其扩展名更改为.zip。

  3. 展开.zip文件。这将生成一个包含.app包的Payload文件夹。

  4. 打开终端并将工作目录更改为.app包cd的顶级path / to / Payload / your.app

  1. Create an Inspectable .ipa file. In the Xcode Organizer (Xcode->Window->Organizer), select an archive to inspect, click "Export...", and choose "Export for Enterprise or Ad-Hoc Deployment". This will create a local copy of the .ipa file for your app.
  2. Locate that .ipa file and change its the extension to .zip.
  3. Expand the .zip file. This will produce a Payload folder containing your .app bundle.
  4. Open a terminal and change the working directory to the top level of your .app bundle cd path/to/Payload/your.app

使用find工具查找.app包中的Assets.car文件,如下所示:find。-name 'Assets.car'

Use the find tool to locate Assets.car files in your .app bundle as shown below: find . -name 'Assets.car'

使用assetutil工具查找应用程序所具有的每个Assets.car中的任何16位或P3资产,如下所示: sudo xcrun --sdk
iphoneos assetutil --info /path/to/a/Assets.car> /tmp/Assets.json

Use the assetutil tool to find any 16-bit or P3 assets, in each Assets.car your application has as shown below. : sudo xcrun --sdk iphoneos assetutil --info /path/to/a/Assets.car > /tmp/Assets.json

检查得到的/tmp/Assets.json并查找任何内容inDisplayGamut:P3及其相关的名称。这将是
是包含一个或多个16位或P3
资产的图像集的名称。

Examine the resulting /tmp/Assets.json and look for any contents containing "DisplayGamut": "P3" and its associated "Name". This will be the name of your imageset containing one or more 16-bit or P3 assets.

用8替换这些资产-bit / sRGB资产,然后重建您的应用程序。更新:如果您的部署目标设置为8.3或8.4
并且您有资产目录,那么即使您实际上没有16位或P3资产,您也会收到同样的错误
消息。在
这种情况​​下,您需要将部署目标降低到8.2,
或将其移至9.x。

Replace those assets with 8-bit / sRGB assets, then rebuild your app. Update: If your Deployment Target is set to either 8.3 or 8.4 and you have an asset catalog then you will receive this same error message, even if you do not actually have 16-bit or P3 assets. In this case you will either need to lower your Deployment Target to 8.2, or move it up to 9.x.

更新:如果您的部署目标设置为8.3或8.4且您有资产目录,那么即使您实际上没有,也会收到相同的错误消息拥有16位或P3资产。在这种情况下,您需要将部署目标降低到8.2,或将其移动到9.x.

Update: If your Deployment Target is set to either 8.3 or 8.4 and you have an asset catalog then you will receive this same error message, even if you do not actually have 16-bit or P3 assets. In this case you will either need to lower your Deployment Target to 8.2, or move it up to 9.x.

这篇关于仅在运行iOS 8的xcode 8上运行EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆