Question

Using - Sencha Touch 2.3, Apigee Usergrid JS SDK, and PhoneGap 3.2.

I am able to run my app in the browser and access Apigee perfectly.

index.html:

`<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
type="text/javascript"></script>
<script src="../lib/apigee.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true </script>
<!-- The line below must be kept intact for Sencha Command to build your application -->
<script id="microloader" type="text/javascript" src=".sencha/app/microloader/development.js"></script>`

This is my code straight from Apigee Javascript SDK(again in index.html):

`<script type="text/javascript">
     var client = new Usergrid.Client({
         orgName:'orgname',
         appName:'sandbox',
         logging: true, 
         buildCurl: true
        });
</script>`

So to test in my view "client.URI" gives me "https://api.usergrid.com" as expected. All good there.

Image here of "client.URI" in a button. http://minus.com/i/BtmXiuVxljsV

When I run

$ sencha app build -run native

This is where I run into problems. Everything works great except when I try to tie in Apigee. The app does not load in the IOS emulator when I do. In my phonegap config or "whitelist" I have opened up access to everything with the "*" wildcard. I am pretty sure this is working because Google maps API is working great. I tried to put the "client.URI" test in an alert so when I click a button it shows me the URI. Again this works in the browser, but not in the emulator. The app loads fine but when I click on the button nothing happens. I hope this makes sense. I wanted to make sure the app would load and that I could test the "client.URI" test as independently as possible. Again if I try to render it on load then the app never even loads in the emulator.

When I click on the button that should have an alert with the URI I get this in the system.log:

` <Error>: __hid_dispatch_pthread_root_queue_create_block_invoke: specific=0x505c260 pthread_self=0xb0115000`

I could keep developing in the browser and have access to my Usergrid backend, but I would really like to get this bug fixed and make sure I am not dealing with a bigger architectural problem.

Thanks everyone.

Était-ce utile?

La solution 2

Finally! Thank goodness for nice debugging help from Android. I changed routes and tried it with Android.

It was telling me it couldn't find the Apigee.min.js file. Seems when Phonegap was compiling it either put it in the wrong place or I did to begin with(I'm pretty sure I know which it was)

I changed out my local file to this instead:

 <script src="https://apigee.com/usergrid/sdk/usergrid.0.10.5.js"></script>

and it works now on IOS and Android. Was very strange because it worked so well in the browser previously.

If anyone has some feedback on where I went wrong with the putting the file in my app let me know. As you can see above it was in:

<script src="../lib/apigee.min.js"></script>

Also if anyone has recommendations on when deploying if I should keep using Apigee as a source or adding the file to my app.

Thanks everyone for your time.

Autres conseils

One thing that may make a difference is trying to run the emulator from XCode instead of from the command line. Open the .xcodeproj file that Phonegap makes and run from there. If the emulator still doesn't launch, please let us know.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top