Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 9 fixes (solves #42) #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions BaasBox-iOS-SDK/BAAClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@

static NSString * const boundary = @"BAASBOX_BOUNDARY_STRING";

static NSString * const kBAACharactersToBeEscapedInQuery = @"@/:?&=$;+!#()',*";

static NSString * BAAPercentEscapedQueryStringKeyFromStringWithEncoding(NSString *string, NSStringEncoding encoding) {
static NSString * const kBAACharactersToLeaveUnescapedInQueryStringPairKey = @"[].";

return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, (__bridge CFStringRef)kBAACharactersToLeaveUnescapedInQueryStringPairKey, (__bridge CFStringRef)kBAACharactersToBeEscapedInQuery, CFStringConvertNSStringEncodingToEncoding(encoding));
//Since we're percent-encoding the query URL component, we can use that character set to begin with.
NSMutableCharacterSet * allowedSet = [[NSMutableCharacterSet URLQueryAllowedCharacterSet] mutableCopy];
[allowedSet addCharactersInString:@"[]."];
return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedSet];
}

static NSString * BAAPercentEscapedQueryStringValueFromStringWithEncoding(NSString *string, NSStringEncoding encoding) {
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, (__bridge CFStringRef)kBAACharactersToBeEscapedInQuery, CFStringConvertNSStringEncodingToEncoding(encoding));
return [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
}

#pragma mark - URL Serialization borrowed from AFNetworking
Expand Down
6 changes: 6 additions & 0 deletions BaasBox-iOS-SDK/BAAObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ @interface BAAObject ()

@implementation BAAObject

// This gets rid of the "Method override for the designated initializer of the superlass '-init' not found" warning in Xcode 7 (Issue #42)
- (instancetype) init {
self = [self initWithDictionary:nil];
return nil;
}

- (instancetype) initWithDictionary:(NSDictionary *)dictionary {

self = [super init];
Expand Down