sbjson

“JSONValue” Keyword not getting recognised while using SBJson ?

吃可爱长大的小学妹 提交于 2019-12-04 12:41:24
i have copied SBJson folder into my project and also #import "SBJson.h" But still i am not getting NSDictionary *result = [strResult JSONValue]; Even Xcode does not show any option JSONValue ; even if i write JSONValue than it prompt me error No visible @interface for 'NSString' declares the selector 'JSONValue' You don't need SBJson for this. There is a native class NSJSONSerialization that does this much faster and without the need to import anything. NSDictionary *result = [NSJSONSerialization JSONObjectWithData:[strResult dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]; A

Duplicate Symbol Error: SBJsonParser.o?

好久不见. 提交于 2019-12-04 06:59:18
I currently have ShareKit in my project that is compiled as a static library. It is properly implemented. I also have implemented Amazon's AWS SDK by just adding their framework into my project. It seems that the duplicate symbol is coming from Amazon's AWS SDK file, "AWSIOSSDK". This is what it looks like: And that file is colliding with ShareKit's file, libShareKit.a. This is what that file looks like: Anyway both of these files are ones that I haven't seen before. And it seems that some JSON files are colliding within them. I have looked at other SO questions and they say to do some things

Objective-C - How to convert NSString to escaped JSON string?

穿精又带淫゛_ 提交于 2019-11-30 22:55:03
I have a NSString that may contain quotes,\, /, \r, \n, and I want to convert it to a JSON encoded string so strings like this "text1\text2" becomes \"text1\\text2\" Is there a existing function to let me do this? Also, I am using SBJson in my project but I cannot find whether SBJson can do this or not. NSJSONSerialization is not on the table since my application still needs to support OSX 10.6 Does this answer your question? -(NSString *)JSONString:(NSString *)aString { NSMutableString *s = [NSMutableString stringWithString:aString]; [s replaceOccurrencesOfString:@"\"" withString:@"\\\""

How to serialize a class in IOS sdk (Objective-c)?

安稳与你 提交于 2019-11-30 21:53:18
How to serialize the following class in objective-c so that it can be used with SBJson? I get "JSON serialisation not supported for Animal" error when I use this code. Can someone point out where I am going wrong? The contents of Animal.h file is as below #import <UIKit/UIKit.h> @interface Animal : NSObject<NSCoding> { NSString *name; NSString *description; NSString *imageURL; } @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *description; @property (nonatomic, retain) NSString *imageURL; -(id)initWithName:(NSString *)n description:(NSString *)d url:

How to serialize a class in IOS sdk (Objective-c)?

孤街浪徒 提交于 2019-11-30 18:25:03
问题 How to serialize the following class in objective-c so that it can be used with SBJson? I get "JSON serialisation not supported for Animal" error when I use this code. Can someone point out where I am going wrong? The contents of Animal.h file is as below #import <UIKit/UIKit.h> @interface Animal : NSObject<NSCoding> { NSString *name; NSString *description; NSString *imageURL; } @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *description; @property

create a json string from NSArray

孤者浪人 提交于 2019-11-30 06:29:56
问题 In my iPhone aplication I have a list of custom objects. I need to create a json string from them. How I can implement this with SBJSON or iPhone sdk? NSArray* eventsForUpload = [app.dataService.coreDataHelper fetchInstancesOf:@"Event" where:@"isForUpload" is:[NSNumber numberWithBool:YES]]; SBJsonWriter *writer = [[SBJsonWriter alloc] init]; NSString *actionLinksStr = [writer stringWithObject:eventsForUpload]; and i get empty result. 回答1: This process is really simple now, you don't have to

SBJson Execptions after parsing (__NSArrayM objectForKey:)

孤人 提交于 2019-11-29 17:21:30
I've some problems trying to parse Json using SBJson, I did some research and I can't find something helpfull... I followed some blog about how to do it, but I still get that error : "__NSArrayM objectForKey:" So this is the Json I'm trying to parse : { "result": [ { "authors": [ "Eric Ries" ], "bc": 9780671607, "title": "Yeah", "urlImage": "www.yeah.hey", "description": "Hey..." } ] } This is the code I'm using : SBJsonParser *json; NSDictionary *jsonResults; NSError *jsonError; json = [ SBJsonParser new ]; // Get result in a NSDictionary jsonResults = (NSDictionary*) [ json objectWithString

create a json string from NSArray

喜你入骨 提交于 2019-11-28 19:13:53
In my iPhone aplication I have a list of custom objects. I need to create a json string from them. How I can implement this with SBJSON or iPhone sdk? NSArray* eventsForUpload = [app.dataService.coreDataHelper fetchInstancesOf:@"Event" where:@"isForUpload" is:[NSNumber numberWithBool:YES]]; SBJsonWriter *writer = [[SBJsonWriter alloc] init]; NSString *actionLinksStr = [writer stringWithObject:eventsForUpload]; and i get empty result. This process is really simple now, you don't have to use external libraries, Do it this way, (iOS 5 & above) NSArray *myArray; NSData *jsonData =

How to plot the markers in google maps from a dictionay in ios?

拜拜、爱过 提交于 2019-11-28 13:04:20
问题 In my app, I have done JSON parsing and I got the coordinates in the form of a dictionary, I want to use the coordinates angd plot it in the map, I have using this SBJsonParser *jsonParser = [SBJsonParser new]; NSArray *jsonData = (NSArray *) [jsonParser objectWithString:outputData error:nil]; for(int i=0;i<[jsonData count];i++) { NSDictionary *dict=(NSDictionary *)[jsonData objectAtIndex:i]; Nslog(@"%@",dict); double la=[[dict objectForKey:@"latitude"] doubleValue]; double lo=[[dict

SBJson Execptions after parsing (__NSArrayM objectForKey:)

北城余情 提交于 2019-11-28 12:23:42
问题 I've some problems trying to parse Json using SBJson, I did some research and I can't find something helpfull... I followed some blog about how to do it, but I still get that error : "__NSArrayM objectForKey:" So this is the Json I'm trying to parse : { "result": [ { "authors": [ "Eric Ries" ], "bc": 9780671607, "title": "Yeah", "urlImage": "www.yeah.hey", "description": "Hey..." } ] } This is the code I'm using : SBJsonParser *json; NSDictionary *jsonResults; NSError *jsonError; json = [