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

Updated BAAClient.m to avoid crashing! #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
28 changes: 24 additions & 4 deletions BaasBox-iOS-SDK/BAAClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,12 @@ - (void)getPath:(NSString *)path

[[self.session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {


if(response == nil){
failure(error);
return;
}

NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
Expand Down Expand Up @@ -1530,7 +1535,12 @@ - (void)postPath:(NSString *)path

[[self.session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {


if(response == nil){
failure(error);
return;
}

NSHTTPURLResponse *r = (NSHTTPURLResponse*)response;
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
Expand Down Expand Up @@ -1570,7 +1580,12 @@ - (void)putPath:(NSString *)path
parameters:parameters];
[[self.session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {


if(response == nil){
failure(error);
return;
}

NSHTTPURLResponse *r = (NSHTTPURLResponse*)response;
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
Expand Down Expand Up @@ -1610,7 +1625,12 @@ - (void)deletePath:(NSString *)path
parameters:parameters];
[[self.session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {


if(response == nil){
failure(error);
return;
}

NSHTTPURLResponse *r = (NSHTTPURLResponse*)response;
NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
Expand Down