仅在运行iOS 8的xcode 8上运行EXC_BAD_ACCESS

前端之家收集整理的这篇文章主要介绍了仅在运行iOS 8的xcode 8上运行EXC_BAD_ACCESS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当从 xcode 7 for iOS 8到10编译时,应用程序运行正常,但是当从xcode 8编译时,应用程序仅在iOS 8上正常工作,iOS 8上的应用程序崩溃,应用程序崩溃不一致.有时它会停在一个随机的UI元素,例如:

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

* 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,但我没有获得任何新信息.我也尝试打开地址消毒剂,它也会偶尔崩溃,但通常也会在主要方法

thread #1: tid = 0x11d992,0x020fce9e libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie(),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为iOS 9或10构建时,应用程序工作正常.这只发生在从iOS 8的Xcode 8构建时.任何想法?

解决方法

团队中的其他人找到了答案.虚假.

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

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. 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

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

  6. 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

  7. 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. 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.

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/328838.html

猜你在找的iOS相关文章