App crashing randomly - Not possible to remove variable

  • ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Not possible to remove variable: 400: <unknown var (bug!) with engine as delegate:0x283c8ed40>{id: 33112} colIndex:32 from engine <NSISEngine: 0x129248130>{ delegate:0x12934eaa0

EngineVars:
 0: objective{id: 33102} rowIndex:0
 1: UIImageView:0x12924ec90.Height{id: 32592} rowIndex:1073741824
 2: 0x280a04be0.marker{id: 32591} colIndex:1073741825
 3: UIImageView:0x12924ec90.Width{id: 32807} rowIndex:1
 4: 0x280dc35a0.posErrorMarker{id: 32871} colIndex:1
 5: 0x280dc35a0.negError{id: 32872} rowIndex:88
 6: 0x280dc3d80.posErrorMarker{id: 32873} colIndex:1073741826
 7: 0x280dc3d80.negError{id: 32874} rowIndex:1073741825
 8: UIImageView:0x129353f00.Width{id: 32594} rowIndex:2
 9: 0x280979d60.marker{id: 32593} colIndex:3
10: 0x280dc1e60.posErrorMarker{id: 32875} colIndex:4
11: 0x280dc1e60.negError{id: 32876} rowIndex:3
12: UIImageView:0x129353f00.Height{id: 32822} rowIndex:1073741826
13: 0x280dc39c0.posErrorMarker{id: 32877} colIndex:1073741827
14: 0x280dc39c0.negError{id: 32878} rowIndex:1073741898
15: UIButton:0x1293540d0.Width{id: 32817} rowIndex:4
16: 0x280dc2040.posErrorMarker{id: 32879} rowIndex:93
17: 0x280dc2040.negError{id: 32880} colIndex:6
18: UIButton:0x1293540d0.Height{id: 32820} rowIndex:1073741827
19: 0x280dc3de0.posErrorMarker{id: 32881} rowIndex:96
20: 0x280dc3de0.negError{id: 32882} colIndex:1073741830
21: UILabel:0x129353300.Width{id: 32811} rowIndex:5
22: 0x280dc3e40.posErrorMarker{id: 32883} colIndex:44
23: 0x280dc3e40.negError{id: 32884} rowIndex:90
24: UILabel:0x129353300.Height{id: 32842} colIndex:1073741828
25: 0x280dc27c0.posErrorMarker{id: 32885} colIndex:1073741831
26: 0x280dc27c0.negError{id: 32886} rowIndex:1073741828
27: UILabel:0x129353c90.Width{id: 32840} rowIndex:6
28: 0x280dc1da0.posErrorMarker{id: 32887} colIndex:9
29: 0x280dc1da0.negError{id: 32888} rowIndex:97
30: UILabel:0x129353c90.Height{id: 32829} colIndex:1073741832
31: 0x280dc31e0.posErrorMarker{id: 32889} colIndex:1073741833
32: 0x280dc31e0.negError{id: 32890} rowIndex:1073741900
33: UIImageView:0x12934e490.Width{id: 32596} rowIndex:1073741905
34: UIImageView:0x12934e490.Height{id: 32597} colIndex:1073741844
35: 0x280963a70.marker{id: 32595} colIndex:11
36: 0x280dc2ee0.posErrorMarker{id: 32891} colIndex:12
37: 0x280dc2ee0.negError{id: 32892} rowIndex:8
38: 0x280dc1d40.posErrorMarker{id: 32893} colIndex:1073741835
39: 0x280dc1d40.negError{id: 32894} rowIndex:1073741830
40: UIButton:0x1293543b0.Width{id: 32832} rowIndex:9
41: 0x280dc1440.posErrorMarker{id: 32895} colIndex:0
42: 0x280dc1440.negError{id: 32896} rowIndex:1073741845
43: UIButton:0x1293543b0.Height{id: 32827} rowIndex:1073741831
44: 0x280dc3840.posErrorMarker{id: 32897} colIndex:1073741836
45: 0x280dc3840.negError{id: 32898} rowIndex:1073741829
46: UILabel:0x129353a20.Width{id: 32848} rowIndex:10




and another thousand or so lines.

this crash occurs after I change the language and open the workout page to start a workout immediately, and sometimes on the second time, I open the workout page.

Replies

I change the language and open the workout page to start a workout immediately

Could you explain more the context ?
Do you know what NSISEngine is ?
@Claude31 from what I know NSISEngine optimizes constraints and manages autolayout.
What is "the workout page"? We would need a full crash log to be able to investigate further.

We would need a full crash log to be able to investigate further.

Quite.

When you post your crash report, use the text attachment feature (the paperclip icon) to avoid clogging up the timeline.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
I got a similar crash recently.
My case is a UIStackView contained in a UITableViewCell.
When binding data to the cell, since the content of the UIStackView is dynamic, I remove all the arrangedSubviews in the stack before populating it again with the new content.

For every arranged subview this following block is executed:
Code Block
stack.removeArrangedSubview(subview)
subview.removeFromSuperview()

Crash is indicated to occur on the last of the above lines.
Note that this crash hit randomly, i.e. it cannot be systematically reproduced every time.

Attached is the crash log.
Hope this could help.



  • I got a very similar crash log. Anyone know what causes this? Or how to debug this?

  • I have same kind of code as mentioned by @dbeltram with similar crash report Have tableCell on that adding Custom button which have stackView. So when ever we set or update button we need to remove existing stackview and create new one. Before removing stackview from button i'm removing it's arrange view using removeFromSuperview() method only.

    Not able reproduce this crash at our end. Anyone know what causes this or how to debug/ solve it?

Add a Comment

Hi @dbeltram, Did you found fix for mentioned issue. I am facing same issue and crashing at

subview.removeFromSuperview().
  • I posted the original question. I tried many fixes, but it was fixed when I removed the constraints and added the same constraints. I think the reason this crash occurs is that NSISEngine fails to process certain combinations of constraints, and when I removed and added the constraints, there was some change in order, and it worked. I couldn't put more time into analyzing it at that time, because this issue put me a bit behind my schedule.

  • Similar experience here. I used auto-layout using storyboard when I got those (inconsistent) crashes. I refactored it without the use of a storyboard and don't seem to get those crashes anymore. What caused it, I dunno...

Add a Comment

Is any one found solution for this crash. Facing same issue on 14.6 and onward versions but not able to reproduce. Used stackview and inside that used imageView and label when we again setup removing arragedView and remove their constraints and then remove stackView and add it again. Crash log showing removeFromSuperView stack view crashing.

I had a similar issue, resolved it just yesterday. the solution to it was to remove the following call to

UIView.appearance().semanticContentAttribute = isRTL ? .forceRightToLeft : .forceLeftToRight

/*
  where `isRTL` is a global computed variable that gets the UI direction of the current `Locale` that I set when the user changes the language.
*/

whenever the ui language is changed by the user, and to enforce using the correct layout direction I was Swizzling the UIApplication.userInterfaceLayoutDirection to return the proper UI direction according to the selected language.

Note: I had a crash just once in over 100 tests, where the other +99 tests the issue was a delay in viewing an already created ViewController vc either by otherVC.present(vc) it, nav.push(vc) it, nav.set([vc]), or nav.pop to vc, meaning if the that vc is just created will not cause any delay but if it was already created and presented before, there will be a delay between viewWillAppear and viewDidAppear for ~200mSec x n times UI direction changes

200mSec is relative to the UI complexity of vc.

In that single crash this is the message I got:

Thread 1: "Not possible to remove variable: 2247: <unknown var (bug!) with engine as delegate:0x600001c1b6c0>{id: 47987} colIndex:0 from engine <NSISEngine: 0x14dc8fae0>{ delegate:0x14dc99e20
EngineVars:
      0: objective{id: 42093} rowIndex:0
      1: <bgImage>.Width{id: 41414} rowIndex:1
      2: 0x6000020aaee0.posErrorMarker{id: 41958} colIndex:1
      3: 0x6000020aaee0.negError{id: 41959} rowIndex:456
      4: <bgImage>.Height{id: 41420} rowIndex:1073741824
      5: 0x6000020a8ae0.posErrorMarker{id: 41960} colIndex:1073741825
      6: 0x6000020a8ae0.negError{id: 41961} rowIndex:1073742291
      7: UIImageView:0x14dc502c0.Height{id: 41428} rowIndex:1073741825
      8: 0x6000024589b0.marker{id: 41427} colIndex:1073741828
      9: UIImageView:0x14dc502c0.Width{id: 41426} colIndex:590
     10: 0x6000020ab180.posErrorMarker{id: 41962} colIndex:3
     11: 0x6000020ab180.negError{id: 41963} rowIndex:3
     12: 0x6000020a8ea0.posErrorMarker{id: 41964} colIndex:1073741832
     13: 0x6000020a8ea0.negError{id: 41965} rowIndex:1073741826
     14: 0x600002428f50:UISV-amb"
  • That is great, so instead of forcing layout using semanticContentAttribute you are using UIApplication.userInterfaceLayoutDirection and the bug disappeared right?

Add a Comment

When I use code

UIView.appearance().semanticContentAttribute = isRTL ? .forceRightToLeft : .forceLeftToRight 

app is crashing randomly.