Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18402] LiveView: Throwing error while evaluating Android conditional code on iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-10-02T03:28:55.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.1.0
ComponentsLiveView
LabelssupportTeam
ReporterMarco Cota
AssigneeFeon Sua Xin Miao
Created2015-01-19T17:07:16.000+0000
Updated2015-10-19T21:43:40.000+0000

Description

Issue

While working on Appcelerator Studio and running the app on iOS with liveview we are receiving an error related to an Android conditional code which is causing an error to be thrown in the console "[INFO] : [LiveView] Error Evaluating app.js @ Line: 16".

Log

-- Start simulator log -------------------------------------------------------
[INFO] :   Application started
[DEBUG] :  Reading stylesheet from: /Users/marco/Library/Developer/CoreSimulator/Devices/A84E39F0-A1C7-4056-8017-8E26CF0EDDED/data/Containers/Bundle/Application/12C3A09D-8B20-4334-A8B3-15590578B1BC/sample.app/stylesheet.plist
[LiveView] Client connected
[DEBUG] :  2015-01-19 10:52:21.278 sample[93591:4712422] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.
[DEBUG] :  2015-01-19 10:52:21.278 sample[93591:4712422] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
[INFO] :   sample/1.0 (3.5.0.0014f83)
[DEBUG] :  Loading: /Users/marco/Library/Developer/CoreSimulator/Devices/A84E39F0-A1C7-4056-8017-8E26CF0EDDED/data/Containers/Bundle/Application/12C3A09D-8B20-4334-A8B3-15590578B1BC/sample.app/app.js, Resource: app_js
[DEBUG] :  Loading: /Users/marco/Library/Developer/CoreSimulator/Devices/A84E39F0-A1C7-4056-8017-8E26CF0EDDED/data/Containers/Bundle/Application/12C3A09D-8B20-4334-A8B3-15590578B1BC/sample.app/_app_props_.json, Resource: _app_props__json
[INFO] :   This is iOS
[INFO] :   dd
[INFO] :   [LiveView] Error Evaluating app.js @ Line: 16
[ERROR] :  ReferenceError: Can't find variable: x
[ERROR] :  File: app.js
[ERROR] :  Line: 16
[ERROR] :  SourceId: <null>
[ERROR] :  Backtrace:
[ERROR] :   undefined
[DEBUG] :  Application booted in 330.896020 ms

Testcase

var win = Ti.UI.createWindow();

if(Ti.Platform.osname == 'android'){
	 Ti.API.info('This is Android');
	 var x = 'dd';
	 Ti.API.info(x);
}else{
	 Ti.API.info('This is iOS');
	 var y = 'dd';
	 Ti.API.info(y);
}

win.open();

Steps to repro

1. Enable liveview 2. Run the testcase in iOS Expected Result: The app will open Actual Result: The app opens but we receive an error log "[INFO] : [LiveView] Error Evaluating app.js @ Line: 16" related to and android conditional code

Comments

  1. Feon Sua Xin Miao 2015-03-16

    PR: https://github.com/appcelerator/liveview/pull/84
  2. Kondal Kolipaka 2015-10-02

    Merged into master branch
  3. Harry Bryant 2015-10-19

    Verified as fixed, ran the test case on several iOS configurations, and did not receive the error in question: 8.4 Device & Simulator. 9.0 Device & Simulator. Mac OSX El Capitan 10.11 (15A284) Studio: 4.4.0.201510161811 Ti SDK: 5.2.0.v20151018201232 Appc NPM: 4.2.1-5 Appc CLI: 5.2.0-15 Ti CLI: 5.0.4 Xcode 7.0(7A218) Node v0.12.7 production *Closing ticket.*

JSON Source