deserialization failure with swift4.2 (xcode10) Abort trap: 6 - ios

I tried to transfer swift 4 to swift 4.2 with XCode 10.0 release
then got this msg:
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
could not find 'init(frame:)' in parent class
0 swift 0x00000001050f864a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x00000001050f7dfe SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff77964b3d _sigtramp + 29
3 libsystem_platform.dylib 0x00007ffeee8fb4e0 _sigtramp + 1996057024
4 libsystem_c.dylib 0x00007fff778231c9 abort + 127
5 swift 0x000000010255e0fb swift::ModuleFile::fatal(llvm::Error) + 1915
6 swift 0x0000000102595753 getSILDeclRef(swift::ModuleFile*, llvm::ArrayRef<unsigned long long>, unsigned int&) + 307
7 swift 0x0000000102597a94 swift::SILDeserializer::readVTable(llvm::PointerEmbeddedInt<unsigned int, 31>) + 740
8 swift 0x000000010263e84b swift::SerializedSILLoader::getAllForModule(swift::Identifier, swift::FileUnit*) + 331
9 swift 0x00000001013889be performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 34558
10 swift 0x000000010137cdc5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
11 swift 0x0000000101322a35 main + 1349
12 libdyld.dylib 0x00007fff7777b085 start + 1
and this in the end:
1. While deserializing SIL vtable for 'MenuNavTitleView' in module 'projectName'
error: Abort trap: 6
I looked for some reasons such as .zero, then even I replaced all .zero in my code, it still have this problem.
Does someone know how to fix this fatal error?

I was facing the same problem in Xcode 10.2.1.
After days trying to solve it, I discovered that in my case this error was caused by a Swift class that inherits an Objective-C Third Party class (more specifically the FSCalendarCell class from https://github.com/WenchaoD/FSCalendar).
I rewrote the Swift class for Objective-C and it compiled and ran without any issues.

Related

What is iOS's block_destroy_helper function?

I noticed a function named block_destroy_helper in this crash log from my iOS app. I want to know more what is this function, but I can't find any useful information. I just want to know the followings:
What is this function doing?
What event can trigger a call to this function?
When I reproduce this crash on Debug build, this crash was an index out of bound error in my own source code. How could this error turned into block_destroy_helper in Release build?
For crash log below, MyModule is a module in my app written in Swift. MyModule uses another library AsyncDisplayKit written in Objective-C.
Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x0000000106d5e7ec
Crashed: com.apple.main-thread
0 MyModule 0x967ec block_destroy_helper.26 + 5740
1 MyModule 0x97048 block_destroy_helper.26 + 7880
2 AsyncDisplayKit 0x2ee28 -[ASCollectionView collectionView:didSelectItemAtIndexPath:] + 208
3 UIKitCore 0x3006e0 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:deselectPrevious:performCustomSelectionAction:] + 816
4 UIKitCore 0x54c4d4 -[UICollectionView touchesEnded:withEvent:] + 480
UPDATE
Finally, I can reproduce the crash. But when I reproduce this crash on Debug build, the crash was from my code, and was an Array index out of bound error (as shown below).
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x32cb4 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 356
1 libswiftCore.dylib 0x32a1c closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 192
2 libswiftCore.dylib 0x323bc _assertionFailure(_:_:file:line:flags:) + 228
3 libswiftCore.dylib 0x12274 _ContiguousArrayBuffer.capacity.getter + 274
4 libswiftCore.dylib 0x15d14 Array.subscript.getter + 84
5 MyModule 0x135d08 $s9MyModule16HomeMenuListNodeC010collectionF0_15didSelectItemAtySo012ASCollectionF0C_10Foundation9IndexPathVtF + 872
6 MyModule 0x137d64 $s9MyModule16HomeMenuListNodeC010collectionF0_15didSelectItemAtySo012ASCollectionF0C_10Foundation9IndexPathVtFTo + 136
7 AsyncDisplayKit 0x763a4 -[ASCollectionView collectionView:didSelectItemAtIndexPath:] + 272
8 UIKitCore 0x2f2c64 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:deselectPrevious:performCustomSelectionAction:] + 1020
9 UIKitCore 0x666864 -[UICollectionView touchesEnded:withEvent:] + 612

Xcode Version 10.2 (10E125) - error while creating archive - error: Segmentation fault: 11 ( workaround solution found )

We have XCode 10.1 and XCode 10.2 on two different mac. The same project is debugging on mac devices and archiving from XCode 10.1. The project is in Swift 4.2. It also has Objective C files.
But it is not archiving from XCode version 10.2. ( It properly run in debug on devices )
Following is the error
CompileSwift normal arm64 (in target:
.....
..... warnings .....
.....
2. While running pass #13773 SILModuleTransform "LoadableByAddress".
0 swift 0x000000010e0a2ee3 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x000000010e0a26bc SignalHandler(int) + 348
2 libsystem_platform.dylib 0x00007fff589b5b3d _sigtramp + 29
3 libsystem_platform.dylib 0x0000000000000008 _sigtramp + 2808390888
4 swift 0x000000010a139059 (anonymous namespace)::LoadableByAddress::runOnFunction(swift::SILFunction*) + 15961
5 swift 0x000000010a131a8b (anonymous namespace)::LoadableByAddress::run() + 75
6 swift 0x000000010acfa308 swift::SILPassManager::execute() + 7416
7 swift 0x000000010a0e451b runIRGenPreparePasses(swift::SILModule&, swift::irgen::IRGenModule&) + 1739
8 swift 0x000000010a0e2be0 swift::performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::GlobalVariable**) + 1392
9 swift 0x0000000109f07030 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49280
10 swift 0x0000000109ef76de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
11 swift 0x0000000109e957be main + 1246
12 libdyld.dylib 0x00007fff587caed9 start + 1
13 libdyld.dylib 0x000000000000004b start + 2810401139
error: Segmentation fault: 11
Please let me have some clues to find the error.
Is it necessary to clear all the warnings ?
Regards
Sanjay
Update 1
Removed arm64 from Build Settings >> Architectures >> Valid Architectures
I Could build the Archive. ( I can not skip arm64, as it is compulsory for deployment )
But it means, one of my used library has issues in build of arm64. Need to find more. Problem could not be solved by XCode update 10.2.1
Update 2
Further searching found the answer at this link on stackoverflow.
the "solution" was to turn swift compiler code generation optimization level to -Onone in build settings for the release configuration.
This could not be a proper or correct solution, but at least for time being, this solution works.

Command failed due to signal: Segmentation fault: 11 while archiving

I tried to archive my App and get this error:
Command failed due to signal: Segmentation fault: 11
When I Build it everything went fine, also on real devices. While archiving this happens. Any Ideas how to fix ?
This is a part of the error:
0 swift 0x000000010f79f3ad PrintStackTraceSignalHandler(void*) + 45
1 swift 0x000000010f79eb56 SignalHandler(int) + 790
2 libsystem_platform.dylib 0x00007fffc82d5bba _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000040 _sigtramp + 936551584
4 swift 0x000000010cae0de3 swift::CastOptimizer::optimizeUnconditionalCheckedCastAddrInst(swift::UnconditionalCheckedCastAddrInst*) + 1699
5 swift 0x000000010cb69d4d processFunction(swift::SILFunction&, bool, unsigned int) + 1917
6 swift 0x000000010cb70c9f (anonymous namespace)::ConstantPropagation::run() + 47
7 swift 0x000000010caff89e swift::SILPassManager::runOneIteration() + 5166
8 swift 0x000000010cb051f6 swift::runSILOptimizationPasses(swift::SILModule&) + 3462
9 swift 0x000000010c7ac0e2 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 20114
10 swift 0x000000010c7a52b3 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17859
11 swift 0x000000010c7615cf main + 8239
12 libdyld.dylib 0x00007fffc80c8255 start + 1
13 libdyld.dylib 0x00000000000000ee start + 938704538
And at the end:
1. While running pass #38147 SILFunctionTransform "Constant Propagation" on SILFunction "#_TTSg5VSC29UIApplicationLaunchOptionsKeyS_s8Hashable5UIKit_P__CSo8NSObjectS2_S0_10ObjectiveC_Ps9AnyObject____TFs17_dictionaryUpCastu2_Rxs8Hashable0_S_rFGVs10Dictionaryxq__GS0_q0_q1__".
Try disabling Swift Compiler Optimization for Release
Then if you get any errors for missing files:
In the file inspector of the file click on the folder icon next to "Location" and locate the file manually
In my case, I tested all solutions including disabling optimization in the build settings:
Build Settings > Optimization Level > Release > No optimization [-Onone]
I don't recommend the above solution since this will affect your entire app and your final binary won't be optimized.
Based on contact with technical team at Apple, There are multiple reasons that could lead to this error, however there's a known bug for archiving during optimization and you need to bypass it by finding the place that compiler is failing and add #_optimize(none) at the top of your function that's causing the issue.
This attribute will tell compiler to ignore the function for optimisation.
class MyNavigationController:UINavigationController {
#_optimize(none)
init(navigationController: UINavigationController?, context: AppContextProtocol) {
// content
}
}
Check Build Settings -> Swift 3 #Objc inference. It most likely should be off.

Xcode - Compile Swift Segmentation Fault 11

Project configuration:
Xcode 7.3.1
min iOS version 7.1
iOS SDK 9.3
cocoapods
While trying to compile mixed Objective-C/Swift project - getting error Segmentation Fault 11, with the next build log:
Compile *.swift
Command failed due to signal: Segmentation Fault 11
In details of, error I can see really long output with some useful info:
CompileSwift normal arm64 filePath/*.swift
0 swift 0x000000010b73266b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1 swift 0x000000010b731956 llvm::sys::RunSignalHandlers() + 70
2 swift 0x000000010b732ccf SignalHandler(int) + 287
3 libsystem_platform.dylib 0x00007fff8b49e52a _sigtramp + 26
4 libsystem_platform.dylib 0x00007fa8f989d5e0 _sigtramp + 1849684176
5 swift 0x000000010994d737 swift::ClangImporter::Implementation::addEntryToLookupTable(clang::Sema&, swift::SwiftLookupTable&, clang::NamedDecl*) + 151
6 swift 0x000000010994d802 swift::ClangImporter::Implementation::addEntryToLookupTable(clang::Sema&, swift::SwiftLookupTable&, clang::NamedDecl*) + 354
7 swift 0x000000010994e44c swift::ClangImporter::Implementation::importHeader(swift::ModuleDecl*, llvm::StringRef, swift::SourceLoc, bool, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >) + 1468
8 swift 0x000000010994ebc6 swift::ClangImporter::importBridgingHeader(llvm::StringRef, swift::ModuleDecl*, swift::SourceLoc, bool) + 502
9 swift 0x000000010993ef2d swift::CompilerInstance::performSema() + 605
10 swift 0x0000000109482596 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 934
11 swift 0x000000010948168d frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2781
12 swift 0x000000010947d0ac main + 1932
13 libdyld.dylib 0x00007fff887b05ad start + 1
14 libdyld.dylib 0x000000000000026b start + 2005204159
And architecture compile error changes, if I switch from device to simulator and backwards, so shouldn't be architecture problem.
Reading Mac Console output I can see, crashes in SourceKit Service, at the same moment:
Thread 4 Crashed:: Dispatch queue: com.apple.root.default-qos
0 com.apple.SourceKitService.703.0.18.8 0x0000000106f1ca63 swift::ClangNode::getLocation() const + 19
1 com.apple.SourceKitService.703.0.18.8 0x0000000106c22a0f swift::ClangImporter::lookupBridgingHeaderDecls(llvm::function_ref<bool (swift::ClangNode)>, llvm::function_ref<void (swift::Decl*)>) const + 111
2 com.apple.SourceKitService.703.0.18.8 0x0000000106c22cb8 swift::ClangImporter::lookupDeclsFromHeader(llvm::StringRef, llvm::function_ref<bool (swift::ClangNode)>, llvm::function_ref<void (swift::Decl*)>) const + 216
3 com.apple.SourceKitService.703.0.18.8 0x00000001069a9034 swift::ide::printHeaderInterface(llvm::StringRef, swift::ASTContext&, swift::ASTPrinter&, swift::PrintOptions const&) + 852
4 com.apple.SourceKitService.703.0.18.8 0x00000001068bf368 SourceKit::SwiftInterfaceGenContext::create(llvm::StringRef, bool, llvm::StringRef, swift::CompilerInvocation, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 1992
5 com.apple.SourceKitService.703.0.18.8 0x00000001068c1de8 SourceKit::SwiftLangSupport::editorOpenHeaderInterface(SourceKit::EditorConsumer&, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<char const*>) + 1704
6 com.apple.SourceKitService.703.0.18.8 0x00000001068d7895 handleRequestImpl(void*, std::__1::function<void (void*)>) + 6773
7 com.apple.SourceKitService.703.0.18.8 0x00000001068d5dc4 sourcekitd::handleRequest(void*, std::__1::function<void (void*)>) + 420
Problem has occurred absolutely randomly project was always working fine, and at one point just stopped running on simulator, but continued running fine on device. After that it just stopped running anyway. Going back commit by commit, I can see, that this problem existed during the last couple of weeks, and checking every change it is quite a bit job and doesn't give any results.
Apparently it is some Xcode issue, but cleaning, removing derived data, module caches, Xcode settings, reinstalling Xcode, using beta version and previous version of Xcode, removing Source Kit Service, disabling/enabling modules support, bitcode, increasing/decreasing deployment target and any other suggestions, that can be googled - give the same result.
Reading internet comments - the problem should be in some part of the code, related with swift, but completely commenting or removing all swift related code gives another error:
cyclic dependency in module 'darwin'
And this way any of the frameworks like Foundation or UIKit, cannot be compiled, and I'm getting hundreds of errors, related to unknown classes.
Creating new project and adding files there one by one, didn't give any result as well - after adding all files and installing cocoapods, project has worked fine for some time, but after that - the same problem has started again.
So I see no way, how to find the exact part of code, which causes the problem (which really is Xcode bug, but there is almost no hope, that it will be fixed in Xcode 8, because it still exists in Beta version).
Will be glad to hear any help regarding this issue, I just can't sleep for a couple of days because of it :)
Found what has caused my issue:
I've had "Math.h" custom file and class in project, importing and using it caused an issue.
The strangest thing, that this file was in project during last 18 days, but everything worked fine. I guess, that it depends on how I'm using it, using it in Objective-C project, doesn't cause any issue.

+[UIPasteboard _accessibilityUseQuickSpeakPasteBoard]: unrecognized selector sent to class

I asked this question on Apple Dev forum, but still didn't get an answer.
We expirience 100% iOS 8 devices crash:
+[UIPasteboard _accessibilityUseQuickSpeakPasteBoard]: unrecognized selector sent to class
The stack trace is:
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2889ec1f __exceptionPreprocess + 126
1 libobjc.A.dylib 0x36049c8b objc_exception_throw + 38
2 CoreFoundation 0x288a3f55 __CFExceptionProem
3 CoreFoundation 0x288a1def ___forwarding___ + 354
4 CoreFoundation 0x287d3df8 _CF_forwarding_prep_0 + 24
5 UIAccessibility 0x331fc157 +[UIPasteboard_QSExtras pasteboardWithName:create:] + 30
6 MyApp 0x002eb507 -[TJEventOptimizer .cxx_destruct]
7 MyApp 0x002eb28b -[TJEventOptimizer .cxx_destruct]
8 MyApp 0x002f0c2b -[TJEventOptimizer .cxx_destruct]
9 MyApp 0x002eeedb -[TJEventOptimizer .cxx_destruct]
10 Foundation 0x295adb5b __NSThread__main__ + 1118
11 libsystem_pthread.dylib 0x3670ce93 _pthread_body + 138
12 libsystem_pthread.dylib 0x3670ce07 _pthread_start + 118
13 libsystem_pthread.dylib 0x3670ab90 thread_start + 8
Despite the fact, TapJoy is captured in the stack trace, their FAQ says it is ocaisonally wrong and has nothing to do with TapJoy's code, but rather iOS 8 bug.
Is it correct?
What accessibility setting related to the crash?
This problem appears because TapJoy has used categories in static library (that's UIPasteboard_QSExtras)
The solution is super simple, you need to notify linker about that
1) Click on the project
2) Click on the target
3) Open Build Settings tab
4) Search for Other Linker Flags
5) Double click on Other Linker Flags
6) Add -ObjC and -all_load flags
7)
Remove binary (delete from device/simulator),
Clean project (hitting cmd+shift+k) and
build again (hitting cmd+b).
You're ready to go!
the solution suggested by I0gg3r unfortunately does not work.. I tested this on 3 apps, and still find the UIPasteboard crash as most frequent crash.. Any other suggestions? Is there a way to disable the accessibility settings in the app?
Update: Tapjoy has released an update (10.2.1) which solves this issue. Please download their latest SDK

Resources