Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: becka11y/incubator-cordova-ios
...
head fork: becka11y/incubator-cordova-ios
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
View
2  CordovaLib/Classes/CDVCapture.m
@@ -339,7 +339,7 @@ - (void) getMediaModes: (NSMutableArray*)arguments withDict:(NSMutableDictionary
movieArray ? (NSObject*)movieArray : [NSNull null], @"video",
audioArray ? (NSObject*)audioArray : [NSNull null], @"audio",
nil];
- NSString* jsString = [NSString stringWithFormat:@"navigator.device.capture.setSupportedModes(%@);", [modes JSONString]];
+ NSString* jsString = [NSString stringWithFormat:@"navigator.device.capture.setSupportedModes(%@);", [modes cdvjk_JSONString]];
[self writeJavascript:jsString];
View
2  CordovaLib/Classes/CDVDevice.m
@@ -44,7 +44,7 @@ - (void)getDeviceInfo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)
// TODO: turn this into an iOS only plugin
NSDictionary *temp = [CDVViewController getBundlePlist:@"Settings"];
if ([temp respondsToSelector:@selector(JSONString)]) {
- [result appendFormat:@"\nwindow.Settings = %@;", [temp JSONString]];
+ [result appendFormat:@"\nwindow.Settings = %@;", [temp cdvjk_JSONString]];
}
NSString* jsResult = [self.webView stringByEvaluatingJavaScriptFromString:result];
View
2  CordovaLib/Classes/CDVPluginResult.m
@@ -117,7 +117,7 @@ -(NSString*) toJSONString{
self.status, @"status",
self.message ? self.message : [NSNull null], @"message",
self.keepCallback, @"keepCallback",
- nil] JSONString];
+ nil] cdvjk_JSONString];
DLog(@"PluginResult:toJSONString - %@", resultString);
return resultString;
View
2  CordovaLib/Classes/CDVSound.m
@@ -141,7 +141,7 @@ - (NSString*) createMediaErrorWithCode: (CDVMediaError) code message: (NSString*
NSMutableDictionary* errorDict = [NSMutableDictionary dictionaryWithCapacity:2];
[errorDict setObject: [NSNumber numberWithUnsignedInt: code] forKey:@"code"];
[errorDict setObject: message ? message : @"" forKey: @"message"];
- return [errorDict JSONString];
+ return [errorDict cdvjk_JSONString];
}
// DEPRECATED
View
4 CordovaLib/Classes/CDVViewController.m
@@ -768,14 +768,14 @@ - (int) executeQueuedCommands
// Parse the returned JSON array.
NSArray* queuedCommands =
- [queuedCommandsJSON objectFromJSONString];
+ [queuedCommandsJSON cdvjk_objectFromJSONString];
// Iterate over and execute all of the commands.
for (NSString* commandJson in queuedCommands) {
if(![self.commandDelegate execute:
[CDVInvokedUrlCommand commandFromObject:
- [commandJson mutableObjectFromJSONString]]])
+ [commandJson cdvjk_mutableObjectFromJSONString]]])
{
static NSUInteger maxLogLength = 1024;
NSString* commandString = ([commandJson length] > maxLogLength) ?
View
64 CordovaLib/Classes/JSON/JSONKit.h
@@ -176,22 +176,22 @@ typedef struct CDVJKParseState CDVJKParseState; // Opaque internal, private type
////////////
@interface NSString (CDVJSONKitDeserializing)
-- (id)objectFromJSONString;
-- (id)objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
-- (id)mutableObjectFromJSONString;
-- (id)mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+- (id)cdvjk_objectFromJSONString;
+- (id)cdvjk_objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
+- (id)cdvjk_objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+- (id)cdvjk_mutableObjectFromJSONString;
+- (id)cdvjk_mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
+- (id)cdvjk_mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
@interface NSData (CDVJSONKitDeserializing)
// The NSData MUST be UTF8 encoded JSON.
-- (id)objectFromJSONData;
-- (id)objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
-- (id)mutableObjectFromJSONData;
-- (id)mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+- (id)cdvjk_objectFromJSONData;
+- (id)cdvjk_objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
+- (id)cdvjk_objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+- (id)cdvjk_mutableObjectFromJSONData;
+- (id)cdvjk_mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
+- (id)cdvjk_mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
////////////
@@ -203,40 +203,40 @@ typedef struct CDVJKParseState CDVJKParseState; // Opaque internal, private type
// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
// includeQuotes:NO `a "test"...` -> `a \"test\"...`
-- (NSData *)JSONData; // Invokes JSONDataWithOptions:CDVJKSerializeOptionNone includeQuotes:YES
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
-- (NSString *)JSONString; // Invokes JSONStringWithOptions:CDVJKSerializeOptionNone includeQuotes:YES
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
+- (NSData *)cdvjk_JSONData; // Invokes JSONDataWithOptions:CDVJKSerializeOptionNone includeQuotes:YES
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
+- (NSString *)cdvjk_JSONString; // Invokes JSONStringWithOptions:CDVJKSerializeOptionNone includeQuotes:YES
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
@end
@interface NSArray (CDVJSONKitSerializing)
-- (NSData *)JSONData;
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
-- (NSString *)JSONString;
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+- (NSData *)cdvjk_JSONData;
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+- (NSString *)cdvjk_JSONString;
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
@interface NSDictionary (CDVJSONKitSerializing)
-- (NSData *)JSONData;
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
-- (NSString *)JSONString;
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+- (NSData *)cdvjk_JSONData;
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+- (NSString *)cdvjk_JSONString;
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
#ifdef __BLOCKS__
@interface NSArray (CDVJSONKitSerializingBlockAdditions)
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializingBlockAdditions)
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+- (NSData *)cdv_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+- (NSString *)cdv_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
#endif
View
84 CordovaLib/Classes/JSON/JSONKit.m
@@ -2345,33 +2345,33 @@ static id _NSStringObjectFromJSONString(NSString *jsonString, CDVJKParseOptionFl
return(returnObject);
}
-- (id)objectFromJSONString
+- (id)cdvjk_objectFromJSONString
{
- return([self objectFromJSONStringWithParseOptions:CDVJKParseOptionStrict error:NULL]);
+ return([self cdvjk_objectFromJSONStringWithParseOptions:CDVJKParseOptionStrict error:NULL]);
}
-- (id)objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
+- (id)cdvjk_objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
{
- return([self objectFromJSONStringWithParseOptions:parseOptionFlags error:NULL]);
+ return([self cdvjk_objectFromJSONStringWithParseOptions:parseOptionFlags error:NULL]);
}
-- (id)objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
+- (id)cdvjk_objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
{
return(_NSStringObjectFromJSONString(self, parseOptionFlags, error, NO));
}
-- (id)mutableObjectFromJSONString
+- (id)cdvjk_mutableObjectFromJSONString
{
- return([self mutableObjectFromJSONStringWithParseOptions:CDVJKParseOptionStrict error:NULL]);
+ return([self cdvjk_mutableObjectFromJSONStringWithParseOptions:CDVJKParseOptionStrict error:NULL]);
}
-- (id)mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
+- (id)cdvjk_mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
{
- return([self mutableObjectFromJSONStringWithParseOptions:parseOptionFlags error:NULL]);
+ return([self cdvjk_mutableObjectFromJSONStringWithParseOptions:parseOptionFlags error:NULL]);
}
-- (id)mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
+- (id)cdvjk_mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
{
return(_NSStringObjectFromJSONString(self, parseOptionFlags, error, YES));
}
@@ -2380,17 +2380,17 @@ - (id)mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOp
@implementation NSData (CDVJSONKitDeserializing)
-- (id)objectFromJSONData
+- (id)cdvjk_objectFromJSONData
{
- return([self objectFromJSONDataWithParseOptions:CDVJKParseOptionStrict error:NULL]);
+ return([self cdvjk_objectFromJSONDataWithParseOptions:CDVJKParseOptionStrict error:NULL]);
}
-- (id)objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
+- (id)cdvjk_objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
{
- return([self objectFromJSONDataWithParseOptions:parseOptionFlags error:NULL]);
+ return([self cdvjk_objectFromJSONDataWithParseOptions:parseOptionFlags error:NULL]);
}
-- (id)objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
+- (id)cdvjk_objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
{
CDVJSONDecoder *decoder = NULL;
id returnObject = [(decoder = [CDVJSONDecoder decoderWithParseOptions:parseOptionFlags]) objectWithData:self error:error];
@@ -2398,17 +2398,17 @@ - (id)objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
return(returnObject);
}
-- (id)mutableObjectFromJSONData
+- (id)cdvjk_mutableObjectFromJSONData
{
- return([self mutableObjectFromJSONDataWithParseOptions:CDVJKParseOptionStrict error:NULL]);
+ return([self cdvjk_mutableObjectFromJSONDataWithParseOptions:CDVJKParseOptionStrict error:NULL]);
}
-- (id)mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
+- (id)cdvjk_mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags
{
- return([self mutableObjectFromJSONDataWithParseOptions:parseOptionFlags error:NULL]);
+ return([self cdvjk_mutableObjectFromJSONDataWithParseOptions:parseOptionFlags error:NULL]);
}
-- (id)mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
+- (id)cdvjk_mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error
{
CDVJSONDecoder *decoder = NULL;
id returnObject = [(decoder = [CDVJSONDecoder decoderWithParseOptions:parseOptionFlags]) mutableObjectWithData:self error:error];
@@ -2924,24 +2924,24 @@ @implementation NSString (CDVJSONKitSerializing)
// NSData returning methods...
-- (NSData *)JSONData
+- (NSData *)cdvjk_JSONData
{
- return([self JSONDataWithOptions:CDVJKSerializeOptionNone includeQuotes:YES error:NULL]);
+ return([self cdvjk_JSONDataWithOptions:CDVJKSerializeOptionNone includeQuotes:YES error:NULL]);
}
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | ((includeQuotes == NO) ? CDVJKEncodeOptionStringObjTrimQuotes : 0UL) | CDVJKEncodeOptionStringObj) block:NULL delegate:NULL selector:NULL error:error]);
}
// NSString returning methods...
-- (NSString *)JSONString
+- (NSString *)cdvjk_JSONString
{
- return([self JSONStringWithOptions:CDVJKSerializeOptionNone includeQuotes:YES error:NULL]);
+ return([self cdvjk_JSONStringWithOptions:CDVJKSerializeOptionNone includeQuotes:YES error:NULL]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | ((includeQuotes == NO) ? CDVJKEncodeOptionStringObjTrimQuotes : 0UL) | CDVJKEncodeOptionStringObj) block:NULL delegate:NULL selector:NULL error:error]);
}
@@ -2952,34 +2952,34 @@ @implementation NSArray (CDVJSONKitSerializing)
// NSData returning methods...
-- (NSData *)JSONData
+- (NSData *)cdvjk_JSONData
{
return([CDVJKSerializer serializeObject:self options:CDVJKSerializeOptionNone encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]);
}
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]);
}
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]);
}
// NSString returning methods...
-- (NSString *)JSONString
+- (NSString *)cdvjk_JSONString
{
return([CDVJKSerializer serializeObject:self options:CDVJKSerializeOptionNone encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]);
}
@@ -2990,34 +2990,34 @@ @implementation NSDictionary (CDVJSONKitSerializing)
// NSData returning methods...
-- (NSData *)JSONData
+- (NSData *)cdvjk_JSONData
{
return([CDVJKSerializer serializeObject:self options:CDVJKSerializeOptionNone encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]);
}
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]);
}
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]);
}
// NSString returning methods...
-- (NSString *)JSONString
+- (NSString *)cdvjk_JSONString
{
return([CDVJKSerializer serializeObject:self options:CDVJKSerializeOptionNone encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:NULL]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:NULL delegate:NULL selector:NULL error:error]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:NULL delegate:delegate selector:selector error:error]);
}
@@ -3029,12 +3029,12 @@ - (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions
@implementation NSArray (CDVJSONKitSerializingBlockAdditions)
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]);
}
@@ -3043,12 +3043,12 @@ - (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions
@implementation NSDictionary (CDVJSONKitSerializingBlockAdditions)
-- (NSData *)JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
+- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsData | CDVJKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]);
}
-- (NSString *)JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
+- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error
{
return([CDVJKSerializer serializeObject:self options:serializeOptions encodeOption:(CDVJKEncodeOptionAsString | CDVJKEncodeOptionCollectionObj) block:block delegate:NULL selector:NULL error:error]);
}
View
14 CordovaLib/CordovaLibTests/CDVPluginResultJSONSerializationTests.m
@@ -30,14 +30,14 @@ @implementation CDVPluginResultJSONSerializationTests
- (void)testSerializingMessageAsInt {
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:5];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSNumber *message = [dic objectForKey:@"message"];
STAssertTrue([[NSNumber numberWithInt:5] isEqual:message], nil);
}
- (void)testSerializingMessageAsDouble {
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:5.5];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSNumber *message = [dic objectForKey:@"message"];
STAssertTrue([[NSNumber numberWithDouble:5.5] isEqual:message], nil);
}
@@ -52,7 +52,7 @@ - (void)testSerializingMessageAsArray {
nil];
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:testValues];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSArray *message = [dic objectForKey:@"message"];
STAssertTrue([message isKindOfClass:[NSArray class]], nil);
@@ -98,7 +98,7 @@ - (void) testSerializingMessageAsDictionary
[testValues setValue:nestedDict forKey:@"nestedDict"];
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:testValues];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSDictionary *message = [dic objectForKey:@"message"];
[self __testDictionary:testValues withDictionary:message];
@@ -111,7 +111,7 @@ - (void)testSerializingMessageAsErrorCode
nil];
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageToErrorObject:1];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSDictionary *message = [dic objectForKey:@"message"];
[self __testDictionary:testValues withDictionary:message];
@@ -120,7 +120,7 @@ - (void)testSerializingMessageAsErrorCode
- (void)testSerializingMessageAsStringContainingQuotes {
NSString *quotedString = @"\"quoted\"";
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:quotedString];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSString *message = [dic objectForKey:@"message"];
STAssertTrue([quotedString isEqual:message], nil);
}
@@ -128,7 +128,7 @@ - (void)testSerializingMessageAsStringContainingQuotes {
- (void)testSerializingMessageAsStringThatIsNil {
NSString *nilString = nil;
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nilString];
- NSDictionary *dic = [[result toJSONString] objectFromJSONString];
+ NSDictionary *dic = [[result toJSONString] cdvjk_objectFromJSONString];
NSString *message = [dic objectForKey:@"message"];
STAssertTrue([[NSNull null] isEqual:message], nil);
}
View
16 guides/Cordova Plugin Upgrade Guide.md
@@ -22,6 +22,22 @@
This document is for developers who need to upgrade their Cordova plugins to a newer Cordova version. Starting with Cordova 1.5.0, some classes have been renamed, which will require the plugin to be upgraded. Make sure your project itself has been upgraded using the "Cordova Upgrade Guide" document.
+## Upgrading older Cordova plugins to 2.1.0 ##
+
+1. **Install** Cordova 2.1.0
+2. Follow the **"Upgrading older Cordova plugins to 2.0.0"** section, if necessary
+3. No changes in plugin structure from 1.9.x
+4. Change in the method signature of the CordovaLib's JSONKit method categories, they are prefixed with "cdvjk_" now:
+
+ e.g.
+
+ [myDict cdvjk_JSONString];
+
+ instead of:
+
+ [myDict JSONString];
+
+
## Upgrading older Cordova plugins to 2.0.0 ##
1. **Install** Cordova 2.0.0

No commit comments for this range

Something went wrong with that request. Please try again.