Skip to content

App crash when TabView has more than 5 items and different font-style #1426

Closed

Description

@manijak

If/when I add more than 5 items to my TabView component the app crashes. This is for sure a bug. According to iOS dev library, if you add more than 5 items to the Tab controller, it will automatically add a "More" button in the last position, so when you tap it, it will show the other items in a list. Very neat.

Does this also apply in {N}? It should. Otherwise we have to create a "More" Item specifically, add listView innside, populate the list with data for each menu item. Program the tap for each listViewItem, that will also cause a page-navigation away from the view with the original TabView component, etc... Too much work and hassle compared to the native way.

The More Navigation Controller
The tab bar has limited space for displaying your custom items. If you add six or more custom view controllers to a tab bar controller, the tab bar controller displays only the first four items plus the standard More item on the tab bar. Tapping the More item brings up a standard interface for selecting the remaining items.

Activity

  1. enchev commented on Jan 25, 2016

    @enchev
    Contributor

    I've just tested this and here is what I've got with 6 items:

    <Page>
      <TabView>
        <TabView.items>
    
          <TabViewItem title="Tab 1">
            <TabViewItem.view>
              <Label text="Label 1" />
            </TabViewItem.view>
          </TabViewItem>
    
          <TabViewItem title="Tab 2">
            <TabViewItem.view>
              <Label text="Label 2" />
            </TabViewItem.view>
          </TabViewItem>
    
          <TabViewItem title="Tab 3">
            <TabViewItem.view>
              <Label text="Label 3" />
            </TabViewItem.view>
          </TabViewItem>
    
          <TabViewItem title="Tab 4">
            <TabViewItem.view>
              <Label text="Label 4" />
            </TabViewItem.view>
          </TabViewItem>
    
          <TabViewItem title="Tab 5">
            <TabViewItem.view>
              <Label text="Label 5" />
            </TabViewItem.view>
          </TabViewItem>
          <TabViewItem title="Tab 6">
            <TabViewItem.view>
              <Label text="Label 6" />
            </TabViewItem.view>
          </TabViewItem>
    
        </TabView.items>
      </TabView>
    </Page>

    screen shot 2016-01-25 at 11 40 50 am
    screen shot 2016-01-25 at 11 42 44 am

  2. manijak commented on Jan 25, 2016

    @manijak
    Author

    Lucky you, this is what I get:

    Starting iOS Simulator
    Jan 25 22:21:20 MacBook-Pro myapp[39178]: assertion failed: 15C50 12H141: libxpc.dylib + 69007 [55209BF0-C183-332C-B272-05E5362CC077]: 0x7d
    
    Jan 25 22:21:21 MacBook-Pro myapp[39178]: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 5 beyond bounds [0 .. 4]'
        *** First throw call stack:
        (
            0   CoreFoundation                      0x030be746 __exceptionPreprocess + 182
            1   libobjc.A.dylib                     0x02d47a97 objc_exception_throw + 44
            2   CoreFoundation                      0x02f9fcb2 -[__NSArrayI objectAtIndex:] + 210
            3   CoreFoundation                      0x0300adf8 -[NSArray objectAtIndexedSubscript:] + 40
            4   myapp                          0x00084be4 _ZN12NativeScript17ObjCWrapperObject25getOwnPropertySlotByIndexEPN3JSC8JSObjectEPNS1_9ExecStateEjRNS1_12PropertySlotE + 52
            5   myapp                          0x0046d466 _ZN3JSC5LLInt8getByValEPNS_9ExecStateENS_7JSValueES3_ + 406
            6   myapp                          0x0046517d llint_slow_path_get_by_val + 205
            7   myapp                          0x00471663 llint_entry + 9102
            8   myapp                          0x004737a3 llint_entry + 17614
            9   myapp                          0x004737a3 llint_entry + 17614
            10  myapp                          0x00473750 llint_entry + 17531
            11  myapp                          0x00473750 llint_entry + 17531
            12  myapp                          0x00473750 llint_entry + 17531
            13  myapp                          0x00473750 llint_entry + 17531
            14  myapp                          0x00473750 llint_entry + 17531
            15  myapp                          0x00473750 llint_entry + 17531
            16  myapp                          0x00473750 llint_entry + 17531
            17  myapp                          0x00473750 llint_entry + 17531
            18  myapp                          0x00473750 llint_entry + 17531
            19  myapp                          0x00473750 llint_entry + 17531
            20  myapp                          0x00473750 llint_entry + 17531
            21  myapp                          0x00473750 llint_entry + 17531
            22  myapp                          0x004737a3 llint_entry + 17614
            23  myapp                          0x004737a3 llint_entry + 17614
            24  myapp                          0x00473750 llint_entry + 17531
            25  myapp                          0x00473750 llint_entry + 17531
            26  myapp                          0x00473750 llint_entry + 17531
            27  myapp                          0x004737a3 llint_entry + 17614
            28  myapp                          0x004737a3 llint_entry + 17614
            29  myapp                          0x004737a3 llint_entry + 17614
            30  myapp                          0x004737a3 llint_entry + 17614
            31  myapp                          0x004737a3 llint_entry + 17614
            32  myapp                          0x00473750 llint_entry + 17531
            33  myapp                          0x00473750 llint_entry + 17531
            34  myapp                          0x00473750 llint_entry + 17531
            35  myapp                          0x004737a3 llint_entry + 17614
            36  myapp                          0x004737a3 llint_entry + 17614
            37  myapp                          0x004737a3 llint_entry + 17614
            38  myapp                          0x004737a3 llint_entry + 17614
            39  myapp                          0x004737a3 llint_entry + 17614
            40  myapp                          0x004737a3 llint_entry + 17614
            41  myapp                          0x004737a3 llint_entry + 17614
            42  myapp                          0x004737a3 llint_entry + 17614
            43  myapp                          0x004737a3 llint_entry + 17614
            44  myapp                          0x0046f14a vmEntryToJavaScript + 257
            45  myapp                          0x00404139 _ZN3JSC7JITCode7executeEPNS_2VMEPNS_14ProtoCallFrameE + 153
            46  myapp                          0x003df9bd _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 413
            47  myapp                          0x005693bd _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 93
            48  myapp                          0x0008042b _ZN12NativeScript11FFICallbackINS_18ObjCMethodCallbackEE12callFunctionERKN3JSC7JSValueERKNS3_7ArgListEPv + 139
            49  myapp                          0x0007fa3e _ZN12NativeScript18ObjCMethodCallback18ffiClosureCallbackEPvPS1_S1_ + 382
            50  myapp                          0x000805f4 _ZN12NativeScript11FFICallbackINS_18ObjCMethodCallbackEE18ffiClosureCallbackEP7ffi_cifPvPS5_S5_ + 68
            51  myapp                          0x007401b6 ffi_closure_SYSV_inner + 160
            52  myapp                          0x0073fc02 .LCFI7 + 5
            53  UIKit                               0x016721a1 -[UIViewController _setViewAppearState:isAnimating:] + 545
            54  UIKit                               0x0167271a -[UIViewController __viewWillAppear:] + 148
            55  UIKit                               0x016a612c -[UINavigationController _startTransition:fromViewController:toViewController:] + 934
            56  UIKit                               0x016a6d85 -[UINavigationController _startDeferredTransitionIfNeeded:] + 669
            57  UIKit                               0x016a7a01 -[UINavigationController __viewWillLayoutSubviews] + 57
            58  UIKit                               0x01821700 -[UILayoutContainerView layoutSubviews] + 213
            59  UIKit                               0x0159c52a -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 668
            60  libobjc.A.dylib                     0x02d5d771 -[NSObject performSelector:withObject:] + 70
            61  QuartzCore                          0x050a6e47 -[CALayer layoutSublayers] + 144
            62  QuartzCore                          0x0509a925 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 403
            63  QuartzCore                          0x0509a77a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
            64  QuartzCore                          0x04ff6c22 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 284
            65  QuartzCore                          0x04ff80b5 _ZN2CA11Transaction6commitEv + 487
            66  QuartzCore                          0x050c084d +[CATransaction flush] + 52
            67  UIKit                               0x01506a66 -[UIApplication _reportMainSceneUpdateFinished:] + 39
            68  UIKit                               0x015079d9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3182
            69  UIKit                               0x015208ee __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
            70  UIKit                               0x01505ffa -[UIApplication workspaceDidEndTransaction:] + 155
            71  FrontBoardServices                  0x042c0c9e __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
            72  FrontBoardServices                  0x042c072f __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
            73  FrontBoardServices                  0x042d2d7c __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 30
            74  CoreFoundation                      0x02fe0050 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
            75  CoreFoundation                      0x02fd5963 __CFRunLoopDoBlocks + 195
            76  CoreFoundation                      0x02fd57bb __CFRunLoopRun + 2715
            77  CoreFoundation                      0x02fd4a5b CFRunLoopRunSpecific + 443
            78  CoreFoundation                      0x02fd488b CFRunLoopRunInMode + 123
            79  UIKit                               0x015059b2 -[UIApplication _run] + 571
            80  UIKit                               0x015090b6 UIApplicationMain + 1526
            81  myapp                          0x0073fb1d .LCFI1 + 26
            82  myapp                          0x007400ff ffi_call + 132
            83  myapp                          0x00050c43 _ZN12NativeScript7FFICall4callEPN3JSC9ExecStateE + 275
            84  myapp                          0x0046e7f8 _ZN3JSC5LLInt9setUpCallEPNS_9ExecStateEPNS_11InstructionENS_22CodeSpecializationKindENS_7JSValueEPNS_17LLIntCallLinkInfoE + 520
            85  myapp                          0x0046b1c6 llint_slow_path_call + 182
            86  myapp                          0x00473791 llint_entr
    y + 17596
            87  myapp                          0x004737a3 llint_entry + 17614
            88  myapp                          0x004737a3 llint_entry + 17614
            89  myapp                          0x004737a3 llint_entry + 17614
            90  myapp                          0x0046f14a vmEntryToJavaScript + 257
            91  myapp                          0x00404139 _ZN3JSC7JITCode7executeEPNS_2VMEPNS_14ProtoCallFrameE + 153
            92  myapp                          0x003df9bd _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 413
            93  myapp                          0x00569431 _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListERN3WTF8NakedPtrINS_9ExceptionEEE + 97
            94  myapp                          0x0008abdb -[TNSRuntime executeModule:] + 1611
            95  myapp                          0x0004c41e main + 1006
            96  libdyld.dylib                       0x0359eac9 start + 1
            97  ???                                 0x00000001 0x0 + 1
    
  3. enchev commented on Jan 26, 2016

    @enchev
    Contributor

    Can you post how exactly these tabs are created?

  4. manijak commented on Jan 26, 2016

    @manijak
    Author

    I don't have the code in front of me, but they are created via XML, the same way you did. Just that mine have icons as well.

    I can post some code later today.

  5. manijak commented on Jan 26, 2016

    @manijak
    Author

    I created a new main-view with your example in it. Just copied your code and pasted it. Ran the app, and the same exception came. I removed the last tab-item, ran the app, no exception.

    This does not seem to work.

    EDIT: One thing I notice now, is that I am running iOS 8.4 on simulator. But it should work on 8 as well...

  6. manijak commented on Jan 26, 2016

    @manijak
    Author

    Nope, didn't work on 9.2 either...

  7. enchev commented on Jan 27, 2016

    @enchev
    Contributor

    What is your {N} version?

  8. manijak commented on Jan 27, 2016

    @manijak
    Author

    1.5.2

  9. manijak commented on Jan 29, 2016

    @manijak
    Author

    Found the issue @enchev
    Please test the following in your example.

    Add one (or both) of these in you .css file and run the app.

    Page {
        font-family: "Avenir-Roman";
    }
    TabView{
        font-size:10;
    }

    If we set a different font-familiy or font-size on a main container or the TabView itself, AND you have more than 5 TabItems the app crashes with the above error.

    On a side note, I have also noticed that if you have an ActionBar in you app with the TabView, and you select the "More" tab, the new "more view" adds an additional ActionBar below the one you originaly added.

    Please fix this :(

  10. changed the title [-]App crash when TabView has more than 5 items (iOS)[/-] [+]App crash when TabView has more than 5 items and different font-style[/+] on Jan 30, 2016
  11. self-assigned this
    on Feb 1, 2016
  12. added this to the 1.6.0 milestone on Feb 1, 2016
  13. manijak commented on Feb 1, 2016

    @manijak
    Author

    Genius @enchev :) 👍 Thank you!

    Should I create a separate issue on the part where "More" view adds additional ActionBar if you already have one on the main Page?

  14. lock commented on Aug 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  15. locked and limited conversation to collaborators on Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions