Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23124] iOS: Autolayout does not work with latest master / Build fails

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-04-05T09:37:22.000+0000
Affected Version/sRelease 5.4.0
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsautolayout, ios, qe-5.4.0, scrollableview
ReporterHans Knöchel
AssigneeChee Kiat Ng
Created2016-03-30T13:25:16.000+0000
Updated2016-06-09T17:40:45.000+0000

Description

Nothing more to say. Copy <use-app-thinning>true</use-app-thinning> in the <ios> section of your tiapp.xml and run the project. Make sure you use a 5.4.0 build (scons'd or from the build server). The build will fail with the following error:
[ERROR] ** BUILD FAILED **
[ERROR] The following build commands failed:
[ERROR]         CompileC build/Intermediates/test.build/Debug-iphonesimulator/test.build/Objects-normal/i386/TiUIScrollableView.o Classes/TiUIScrollableView.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
[ERROR] (1 failure)
It can be traced to here:
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:634:33: error: use of undeclared identifier 'scrollview'; did you mean '_scrollView'?
[TRACE]         if (showPageControl && (scrollview!=nil) && ([[scrollview subviews] count]>0)) {
[TRACE]                                 ^~~~~~~~~~
[TRACE]                                 _scrollView
[TRACE] In file included from /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:11:
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.h:17:19: note: '_scrollView' declared here
[TRACE]     UIScrollView* _scrollView;
[TRACE]                   ^
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:634:56: error: use of undeclared identifier 'scrollview'; did you mean '_scrollView'?
[TRACE]         if (showPageControl && (scrollview!=nil) && ([[scrollview subviews] count]>0)) {
[TRACE]                                                        ^~~~~~~~~~
[TRACE]                                                        _scrollView
[TRACE] In file included from /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:11:
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.h:17:19: note: '_scrollView' declared here
[TRACE]     UIScrollView* _scrollView;
[TRACE]                   ^
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:646:33: error: use of undeclared identifier 'scrollview'; did you mean '_scrollView'?
[TRACE]         if (showPageControl && (scrollview!=nil) && ([[scrollview subviews] count]>0)) {
[TRACE]                                 ^~~~~~~~~~
[TRACE]                                 _scrollView
[TRACE] In file included from /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:11:
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.h:17:19: note: '_scrollView' declared here
[TRACE]     UIScrollView* _scrollView;
[TRACE]                   ^
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:646:56: error: use of undeclared identifier 'scrollview'; did you mean '_scrollView'?
[TRACE]         if (showPageControl && (scrollview!=nil) && ([[scrollview subviews] count]>0)) {
[TRACE]                                                        ^~~~~~~~~~
[TRACE]                                                        _scrollView
[TRACE] In file included from /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.m:11:
[TRACE] /Users/hans/Desktop/test/build/iphone/Classes/TiUIScrollableView.h:17:19: note: '_scrollView' declared here
[TRACE]     UIScrollView* _scrollView;
[TRACE]                   ^
[TRACE] 4 errors generated.
Which is suspicious, because the related code is only generated if the #ifdef TI_USE_AUTOLAYOUT is added and it *is* added by our build CLI. As it's related to the ScrollableView, it might already be obsolete, because [~cng] is working on major bugfixes & improvements in that class. But we should leave it here to be tracked.

Comments

  1. Chee Kiat Ng 2016-03-30

    That's correct. on hold for this ticket please I believe I have a PR coming up that may have relation to this.
  2. Chee Kiat Ng 2016-04-01

  3. Chee Kiat Ng 2016-04-05

  4. Hans Knöchel 2016-04-05

    Demo
       var win = Ti.UI.createWindow();
       var clicked = false;
        
       var view1 = Ti.UI.createView({ height: 300, backgroundColor:'#123' });
       var view2 = Ti.UI.createView({ height: 300, backgroundColor:'#246' });
       var view3 = Ti.UI.createView({ height: 300, backgroundColor:'#48b' });
        
       var view4 = Ti.UI.createView({ height: 300, backgroundColor:'#f34' });
       var view5 = Ti.UI.createView({ height: 300, backgroundColor:'#3f4' });
       var view6 = Ti.UI.createView({ height: 300, backgroundColor:'#34f' });
        
       var scrollableView = Ti.UI.createScrollableView({
         views:[view1,view2,view3],
         pageIndicatorColor: "red",
         currentPageIndicatorColor: "green",
         showPagingControl:true
       });
        
       win.add(scrollableView);
       var button = Titanium.UI.createButton({
          title: 'Hello',
          bottom: 10,
          width: 100,
          height: 50
       });
       win.add(button);
       button.addEventListener('click',function(e)
       {
         if (clicked == false){ 
        
          scrollableView.views = [view4,view5,view6];
          Titanium.API.info("You clicked the button");
        } else {
        
            scrollableView.views = [view1,view2,view3];
          Titanium.API.info("You clicked the button");
        }
        clicked = !clicked;
       }); 
        
       win.open();
       
    PR approved!
  5. Harry Bryant 2016-06-09

    Verified as fixed, using the demo code provided, and setting AutoLayout to true and true does not cause the app to crash with the 5.4.0 SDK. Tested On: iPhone 6S (9.3.2) Device Mac OSX El Capitan 10.11.5 Ti SDK: 5.4.0.v20160608165242 Appc Studio: 4.6.0.201605180604 Appc NPM: 4.2.7.-2 App CLI: 5.4.0-11 Xcode 7.3 Node v4.2.6 *Closing ticket.*

JSON Source