Log in or register to post comments

#DEBUG bad Target

April 23, 2014 - 3:08am #1
I get ready with the Books Sample (IOS Platform) , Test it with your Cloud Reco Targets and it works fine , it render a 2d view with the information of the book (Author name, Price, .. Etc) but when I use my cloud database on vuforia managment System it specify the target as bad target
my senario for the  Cloud Database and metadata :
1.Create Cloud Database with one target
2. The target has metadata.txt with this info
{
"title”:”AmrDiab”,
"author”:”Karina Borland”,”average rating":"4",
"# of ratings”:”5”,
"list price":"43.99",
"your price":"43.15",
"targetid":"b4596748d6074917865e5c58e2a6b3a6",
}
 
also the scanning line detect the target but it specify it as abad target and the scanning line disappear ,please inform me if something missed ! ,Thanks

#DEBUG bad Target

May 6, 2014 - 5:05am #6

You need to trace through the step before it gets here i.e. where it calls the delegate in BooksManager.m

Specifically this is in the method below where book starts out as nil, and it will remain so if there is a problem.  Step through this to discover why it is nil.

 

N

 

-(void)infoDownloadDidFinishWithBookData:(NSData *)bookData withConnection:(NSURLConnection *)connection

{

    Book *book = nil;

    

    if (bookData)

    {

        //  Given a NSData, parse the book to a dictionary and then convert it into a Book object

        NSError *anError = nil;

        NSDictionary *bookDictionary = nil;

        

        //  Find out on runtime if the device can use NSJSONSerialization (iOS5 or later)

        NSString *className = @"NSJSONSerialization";

        Class class = NSClassFromString(className);

        

        if (!class)

        {

            //  Use custom BookDataParser.

            //

            //  IMPORTANT: BookDataParser is written to parse data specific to the Books

            //  sample application and is not designed to be used in other applications.

            

            bookDictionary = [BookDataParser parseData:bookData];

            NSLog(@"#DEBUG Using custom JSONBookParser");

        }

        else

        {

            //  Use native JSON parser, NSJSONSerialization

            bookDictionary = [NSJSONSerialization JSONObjectWithData: bookData

                                                             options: NSJSONReadingMutableContainers

                                                               error: &anError];

            NSLog(@"#DEBUG Using NSJSONSerialization");

        }

 

        

        if (!bookDictionary)

        {

            NSLog(@"#DEBUG Error parsing JSON: %@", anError);

        }

        else

        {

            book = [[[Book alloc] initWithDictionary:bookDictionary] autorelease];

        }

    }

    

    //  Inform the delegate that the request has completed

    [delegate infoRequestDidFinishForBook:book withTrackableID:[thisTrackable cStringUsingEncoding:NSASCIIStringEncoding] byCancelling:[self cancelNetworkOperation]];

 

 

// rest of code

 

 

}

#DEBUG bad Target

April 30, 2014 - 9:10am #5

yes i did and when detecting the marker it logs with 

Successfully created new trackable 'track name' with rating '4'.

-(void)infoRequestDidFinishForBook:(Book *)theBook withTrackableID:(const char*)trackable byCancelling:(BOOL)cancelled

{

    if (theBook) // nill 

    {

        trackingTextureAvailable = NO;

        [[ImagesManager sharedInstance] imageForBook:theBook

                                        withDelegate:self];

        NSLog(@"a     >>    %@",theBook.author);

        NSLog(@"b     >>    %@",theBook.bookURL);

        NSLog(@"c     >>    %f",theBook.listPrice);

        NSLog(@"d     >>    %@",theBook.listPriceString);

        NSLog(@"e     >>    %@",theBook.thumbnailURL);

        NSLog(@"f     >>    %@",theBook.title);

        NSLog(@"g     >>    %f",theBook.yourPrice);

        NSLog(@"h     >>    %@",theBook.targetID);     

    }

    else

    {     

        // so it get here 

        if (NO == cancelled)

        {    

            //  The trackable exists but it doesn't exist in our book database, so

            //  we'll mark that UniqueTargetId as a bad target

            [[BooksManager sharedInstance] addBadTargetId:trackable];

        }

         //  If theBook is nil, the loading UI would be shown forever and it

        //  won't scan again.  Send a notification to revert that state

        [[NSNotificationCenter defaultCenter] postNotificationName:@"kStopLoading" object:nil userInfo:nil];

    }

}

 
why the Book Data is nil ?!!

#DEBUG bad Target

April 29, 2014 - 6:55pm #4

Did you walk through your code with the debugger and observe at which point in the code the cloud recognition fails to process the target?

#DEBUG bad Target

April 27, 2014 - 7:44am #3

Good Point Thanks , i did it here is my new metadata 

{
 
"title":"dian",
"author":"Amr Diab","average rating":"4",
"# of ratings":"5",
"list price":"43.99",
"your price":"43.15",
"targetid":"b4596748d6074917865e5c58e2a6b3a6",
 
}
 
but still give me #DEBUG bad target found when detecting the target !!

#DEBUG bad Target

April 24, 2014 - 5:16pm #2

It appears that your JSON object meta data for your target is corrupted due to the use of special double quotes () instead of plain double quotes ( " ):
 

{
"title”:”dian”,
"author”:”Amr Diab”,”average rating":"4",
"# of ratings”:”5”,
...
}

 

Try replacing all of the ( ” ) quotes to ( " ) quotes.
 

Log in or register to post comments