简体   繁体   中英

Swift: iOS 12.2 Crash of the app on launch

after updating Xcode and swift 5, after launching the simulator on iOS 12.2 my application crash on launch. But in earlier versions of ios (like 12.0) the application works correctly. I launched the application on a real device ios 12.0.1 and the app is working properly, then launched the application on an iOS device 12.2 and the app crash

I do not know if it's related but in the console I have this message:

objc[39432]: Swift class extensions and categories on Swift classes are not allowed to have +load methods

Then Xcode redirects to 0_abort_with_payload :

    libsystem_kernel.dylib`__abort_with_payload:
    0x11365200c <+0>:  movl   $0x2000209, %eax          ; imm = 0x2000209 
    0x113652011 <+5>:  movq   %rcx, %r10
    0x113652014 <+8>:  syscall 
->  0x113652016 <+10>: jae    0x113652020               ; <+20>
    0x113652018 <+12>: movq   %rax, %rdi
    0x11365201b <+15>: jmp    0x113634457               ; cerror_nocancel
    0x113652020 <+20>: retq   
    0x113652021 <+21>: nop    
    0x113652022 <+22>: nop    
    0x113652023 <+23>: nop    

The error you mention is very related :)

objc[39432]: Swift class extensions and categories on Swift classes are not allowed to have +load methods

I can't find the reason why it occurs, but the problem seems to be that you, or some dependency you are using is using a static load method, which is no longer allowed.

There are a couple of things you can try

  1. Check your code for load functions
  2. Look through your dependencies and see if there are updates to any of them that could fix this problem

This thread on twitter can also be used to pinpoint where the problem might be. As it is suggested, try adding OBJC_PRINT_LOAD_METHODS=YES when you launch the app, as this should give you some more clues.

Hope that helps.

The problem is solved; I use the Swinject CocoaPod so in the Podfile I updated the corresponding line for that pod with:

pod 'SwinjectStoryboard', :git => 'https://github.com/mdyson/SwinjectStoryboard.git', :branch => 'master'`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM