Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-18765

iOS: WebView do not recognize local HTML File using Ti.sourceDirectory if Project Name has a space

    Details

    • Story Points:
      5
    • Sprint:
      2015 Sprint 08 SDK, 2015 Sprint 10 SDK

      Description

      Description:

      Since Ti SDK 3.5.0, WebView does no recognise the html file when using Ti.sourceDirectory File system, if there is space in app name.

      Reproduce:

      1. Create a classic project named "Simple Test" (with space)
      2. Create a folder named "html" under Resource folder.
      3. Create a simple html file name "comingSoon.html", like following

      comingSoon.html

      <html>
      	<head>
      		<title>Hello World!</title>
      	</head>
      	<body>
      		<div>
      		<p>Content to follow soon</p>
      		</div>
      	</body>
      </html>
      

      4.Add following code into app.js file

      app.js

      ar win = Ti.UI.createWindow({
      	backgroundColor: 'white'
      });
       
      var f = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'/html/comingSoon.html');
      if (f.exists()) {
      	var contents = f.read();
      	alert('Output the file:'+contents.text);
      } else {
      	Ti.API.info("No such file!");
      }
       
      var URL = Ti.Filesystem.resourcesDirectory + '/html/comingSoon.html';
       
      var wv = Ti.UI.createWebView({
      	top: 30,
      	url: URL
      });
       
      win.add(wv);
      win.open();
      

      Expect Result:

      The webview should display normally.

      Actual Result:

      The error pop out in console log:
      "couldn't load URL: app://com.cocoafish.sliangPush/Users/shuoliang/Library/Developer/CoreSimulator/Devices/EA379BD7-8255-4555-9A89-79678C7C68EB/data/Containers/Bundle/Application/BCD65E99-C189-4889-9177-CD870924377D/Simple%20Push.app/html/comingSoon.html"

      Note:

      1. No such problem in SDK 3.4.1
      2. Change the app name without space, problem gone.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cng Chee Kiat Ng (Inactive)
                Reporter:
                sliang Shuo Liang
                Reviewer:
                Chee Kiat Ng (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-19832
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code