Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
fdb2606c
Commit
fdb2606c
authored
May 12, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor generic request for URL to assert instead of return nil.
parent
2c0b946f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+6
-8
No files found.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
fdb2606c
...
...
@@ -556,14 +556,12 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
requestForURL
:
(
NSURL
*
)
url
method
:
(
NSString
*
)
method
object
:
(
id
<
BUYSerializable
>
)
object
completionHandler
:
(
void
(
^
)(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
))
completionHandler
{
NSDictionary
*
json
=
[
object
jsonDictionaryForCheckout
];
NSError
*
error
=
nil
;
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:
json
options
:
0
error
:&
error
];
NSURLSessionDataTask
*
task
=
nil
;
if
(
data
&&
!
error
)
{
task
=
[
self
requestForURL
:
url
method
:
method
body
:
data
completionHandler
:
completionHandler
];
}
return
task
;
NSAssert
(
object
,
@"Failed to perform request. id<BUYSerializable> must not be nil."
);
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:[
object
jsonDictionaryForCheckout
]
options
:
0
error
:
nil
];
NSAssert
(
data
,
@"Failed to perform request. Could not serialize object. Possibly invalid object."
);
return
[
self
requestForURL
:
url
method
:
method
body
:
data
completionHandler
:
completionHandler
];
}
-
(
void
)
startTask
:
(
NSURLSessionDataTask
*
)
task
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment