Module ti.cloud not found when testing on real device. Works in Simulator?

You must Login before you can answer or comment on any questions.

Hello all,

I'm playing around with the new ACS (Cloud services)

When I'm testing in my iOS-simulator everything works like a charm.

But when I open in Xcode and run the project on a real device (iPhone) I get this error: [ERROR] Script Error = Couldn't find module: ti.cloud.

My tiapp.xml have both acs-api-keys, acs-oauth-keys etc. and of cause:

<modules>
   <module platform="commonjs" version="2.0.1">ti.cloud</module>
</modules>

Is this a bug? Others having this issue ?

Only on real devices I have this problem. In simluator everything is smooth! Other projects that does not use the new Cloud-services have no problem compiling and working on real device.

— asked 1 year ago by Daniel Jensen
1 Comment
  • Im having the same issue when trying to build a version and submitting it to apple review team. It runs on my dev devices....but when I manually build my application using XCODE not titanium....the build it creates is failing on the apple review teams devices. I was able to duplicate it locally also. Does anyone know if I have to build with titanium to fix this problem? MY other modules are working fine??

    — commented 12 months ago by Peter Ladis

9 Answers

It seems like the ti.cloud.js file that is in the example folder of the module must be in the resources folder of the app for it to work in the device. Strangely even if its not there the app works in the simulator.

Works with sdk 2.1 and ti.cloud module 2.0.1 WITH THE ti.cloud.js file IN THE RESOURCES FOLDER

Also version 2.1 of the ti.cloud module does not work in simulator or app - tested against sdk 2.0 2.0.1, 2.0.2 and 2.1. I have had to use version 2.0.1 of the t.cloud module

— answered 1 year ago by Imraan Jhetam
answer permalink
2 Comments
  • Thanks for this. Sounds logical from the looks of the crash log I have got. But why wouldn't @appcelerator document such a thing?! - typical leaving the developers in the lurch like that for us to struggle for a few hours to finally find a solution from another developer!

    — commented 12 months ago by Ian Tearle

  • Hi, I have the same problem, I am able to run app on device but not able to do same on simulator, I am using titanium sdk version 2.1.3 GA and ti.cloud 2.3.1 module, can you please provide me with solution what should I do to get rid of the problem.

    Thanks.

    — commented 3 months ago by Moiz Chhatriwala

Do you have the ti.cloud module in your project? If not, please try creating a modules folder in the Resources folder of your project and place ti.cloud there. Also, I noticed you have platform as "commonjs". Should it not be "iphone"?

— answered 1 year ago by Varun Joshi
answer permalink
3 Comments
  • No for ti.cloud it is commonjs (no separate ios, android or html5 module)

    — commented 1 year ago by Imraan Jhetam

  • where would I find the ti.cloud module so that I can include it as suggested above?

    — commented 1 year ago by Bryce Benton

  • If you download the 2.0 SDK from http://builds.appcelerator.com.s3.amazonaws.com/index.html, you would find a modules folder under the SDK with ti.cloud module.

    — commented 1 year ago by Varun Joshi

do i have to put ti.cloud.js in resources of the Xcode project aswell? Still doesn't work...

I'm sorry but I have the same issue and I don't know where can I find this ti.cloud.js file ?

I am having the same issue.

How exactly are you including it in your app? Are you using require() or Ti.Include()?

Thanks!

I have added modules under Resources folder which has ti.cloud.js. I still get the ti.cloud not found error.Is there anything else to be done ?

First you need to enable cloud services on your project using the tiapp.xml, which I'm guessing you did. Now add the line

var Cloud = require('ti.cloud');
to your app.js file. You must also add that line to your other .js files if they are working from a different context/heavy window. After that you can call everything like they do using
Cloud.blabla....
There is no need, as far as I can tell, to add the module. But if you do make sure you call it correctly by pointing to the correct folder like
var Cloud = require('../../modules/ti.cloud');
If you don't understand where the ../../ is coming from spend a few minutes and learn how to navigate around a linux terminal using the cd command. You'll never EVER regret learning that.

I had a similar problem: using the cloud services only in a separate API module (to abstract the cloud services) didn't work on the device, though it worked fine in the simulator.

Make sure that you are loading ti.cloud in the main context [like app.js], as opposed to only in other modules.

Loading the ti.cloud module in app.js (in addition to my app.js file) fixed the problem for me.

When you create a new project, check "enable cloud". This will add hash keys and a few other lines in your tiapp.xml. So, if you have already started a project, create a new one and compare the two. You'll see 6 lines up top for Oauth, etc. and one towards the end such as this:

<modules>
        <module platform="commonjs" version="2.3.0">ti.cloud</module>
    </modules>
This may help some people.

Your Answer

Think you can help? Login to answer this question!