Log in or register to post comments

Cloudreco iOS 7

November 30, 2013 - 10:24am #1

Hi there. I would really need some directions.

Im testing the cloudreco iOS sample app version 2-6-6 on iPhone 5 running iOS7

The test works fine with the three images and books default, original samples.

I created a vuforia cloud database and three images targets(5 star rating each one).

I entered my own access and secret key in CRQCARtils.mm

Changed the default book json url to my own: #define BOOKSJSONURL @"http://myownURL/json"

Also changed the books.json default target IDs to my IDs generated for each of my cloud targets in my vuforia cloud dabatase

Then I update with my own target IDs the default samplebook1.json, samplebook2.json and samplebook3.json provided from Vuforia sample.

I didnt changed nothing more in the json structure from the original sample, only my target IDs.

For each of my targets I also uploaded the metadata files, each one of my targets pointing to the customs samplebook1.json, samplebook2.json and samplebook3.json 

The problem is

Customizing the sample example by only creating my own targets(just three as the sample) and pointing them to my samplebook json files in my own domain only works for ONE target. The others two targets debug shows 

BAD TARGET

or 

CloudReco[1182:60b] #DEBUG Error parsing JSON: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x77dd00 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

Its my setup correct ? Can I have this setup working with the json files hosted in my own domain ? http://viamobilstartup.com/cloudreco/json/

If I use the sample only changing the access and secret keys to my cloud database with my three targets and keep the original BOOKSJSON URL to https://ar.qualcomm.at/samples/cloudreco/json everything starts working normal

What kind of server to build and setup to deliver the correct json files to the sample ?  Could be a couchbase lite server ?

I have a Arvixe linux hosting account.

It would be necessary to create a mysql or postgree database and use a script to deliver the json file for the app? What language PHP ?

Thanks and cheers!

 

Cloudreco iOS 7

January 9, 2014 - 3:29am #10

The metadata .txt file is uploaded to the vuforia cloud database.

The json handler I think is at Book.mm, I dont have the project opened to check exactly right now.

The graphic design do you mean the translucent grey rectangle that shows with information about the books ? I think you can change it but it would be better use Unity. I cant say how to do it because I didnt changed at all(yet).

If you are using XCode you can search for information about all the json variables and serialization by typing json in the search field above the files project.

 

Cheers, good luck!

Cloudreco iOS 7

January 8, 2014 - 11:36am #9

Thanks a lot man, youve been super helpful. I've been going through the code and it's starting to make sense to me now. Do you know where the handler of the meta data is located inside the project? I mean, should i want to modify the graphic design, im guessing it should be ina xib file inside the project right?

 

Anyways, thank you very very much. 

Cloudreco iOS 7

January 3, 2014 - 12:49pm #8

Hi pdavik!

The metadata .txt file is uploaded when uploading your image target and inside the .txt file you just need to put the name of the .json file that have the information about your image, target.

As example: mymetadatafile.txt - inside it  as plain text - myjsonsample.json

The myjsonsample.json file you upload to your web hosting account, to the public folder

You can check the cloudreco .json file that the cloudreco app uses right here in the link below

https://developer.vuforia.com/samples/cloudreco/json/samplebook1.json

Paste it to your browser, hit enter and see the structure and the infos about the book 1, if you want to see the other two just change the end of the url to samplebook2.json and samplebook3.json

Hope it helps

Cheers!

Cloudreco iOS 7

January 3, 2014 - 12:17pm #7

Hey thank you very much, this thread was super enlightening. One minor question though (Ive been going thru this post as some kind of tutorial), when you upload the metadata files (txt) do you upload the "sample1.json" file? Or, could you provide a sample so that i could understand the structure a little bit better? 

Cheers mate, congrats on getting it to work

 

Cloudreco iOS 7

December 5, 2013 - 2:54am #6

Great to hear :)

N

Cloudreco iOS 7

December 4, 2013 - 2:12pm #5

Hello! I figured out what was the json problems and bad target messages showed in Xocde debugger window during my process to customize the Cloudreco sample.

So, here it is the way i did to get the sample working with custom images and json text using only XCode. If you dont like to read all that here is a simple video that I did through the same process below - Customizing Vuforia Cloud Recognition sample for iOS     

1-Create your cloud database and targets in the target manager with 5 green rating stars

2-When uploading the images, inside the .txt metada file use three different names for the json file, for example:

For the target 1 use the json file named sample1.json

For the second target name the json as anothersample1.json

Finally for the third target name the json file as alotsample1.json

In other posts here in the forum  some users said to name the json files as samplebook1, samplebook2 and samplebook3 and so on...

But the problem is exactly that, repeatedly naming. NSJSONSerialization class located in the BooksManager.m file in XCode, understands all three files samplebook1, 2 and 3 as a block or data set, but the code its not done to iterate through the serie. Because of the equal naming, the code cant actually differentiate the json files. 

3-Now customize the json files. Visit this url to copy the structure of json file used by Vuforia in the sample

When copying the .json content dont forget to change  the target ID number for the target ID from your target image provided by Vuforia after the image upload.

4-Go to Xcode search for the file CRQCARUtils.mm. Search for kAccessKey and kSecretKey. Change that sequence with your access and secret keys provided in the Target Manager, copy the sequence number from the Client Access Keys not the Server keys.

5-Search for the file BooksManager.m and in the line BOOKSJSONURL enter the url where your json files are located. The url should not finish with slash /, only http://yourdomain.com/yourdirectory/anothersample1.json

Thats It!

You can use a simple linux web hosting account to store your json files. Im using Arvixe. No database setup or scripting is necessary. Only if you pretend to use a large number of text data it will be better to develop a web service. I will try further a NoSQL cloud service, because it can deliver json documents without the necessity to setup any database etc.

Of course you can customize the json files.  Changing all the price, rating, title or author from the original sample. Also the image thumb and so on, that depends of your project.

I will do a video and upload it, so read all this would not be necessary.

Hope I could help some folks there.

Cheers!

Cloudreco iOS 7

December 2, 2013 - 5:13am #4

Stop

You need to analyse what's going on - maybe you have not looked hard enough.

 

But the sample doesnt seem to find two of the three json

This should give you some clue.

I see two problems:

  1. All your Samplebooks1, 2, and 3 .json refer to the same author (Karina Borland) so you will not get identical results compared to the Vuforia sample
  2. Your samplebook1.json has corrupted characters at the end  es/cloudreco/book1.php”}

 

I should host the thumbs images in my host too ?

You could probably get away without doing this for test purposes initially, but like I mentioned above that's probably not where the problem lies.

So my advice is to check your code again and use the Debugger to help you understand where the problem is - do not magically expect it to work.

 

N

Cloudreco iOS 7

December 2, 2013 - 4:56am #3

hi Nalin, thanks for the reply

I alredy have a web host and the json files are here http://viamobilstartup.com/cloudreco/json/

I did changed the BOOKURL at the sample app, as well as the target ids in the json files.

But the sample doesnt seem to find two of the three json, since when running the app the sample scan my targets but dont show any of the books info or image. It shows only for samplebook1.json

So here is my question

I should host the thumbs images in my host too ?

 

Cloudreco iOS 7

December 2, 2013 - 3:16am #2

Well, Vuforia handles the Cloud Reco part and the sample application is really just a sample - the rest is entirely up to you, as the Server part really is outside the scope of Vuforia.

Yes, the sample shows how to access a JSON file, but there is no server or database behind it - it is simply a resource/file on the Vuforia web site e.g. if you type this into the browser:

https://developer.vuforia.com/samples/cloudreco/json/samplebook1.json

You should see a stream of JSON appear, which is actually the way that a browser interprets and displays that particular file.

If you have a simple web host, just try copying the same file to the host - obviously you will need to change the URL in your app, but it should give you identical results.

The other thing you need to do is use the xcode debugger, to find out exactly what is going wrong and why.

 

HTH

N

 

 

Log in or register to post comments