Skip to content

Commit ebb6af8

Browse files
committed
Fix: Extra argument 'queue' in call #2
1 parent 2ddade5 commit ebb6af8

5 files changed

Lines changed: 59 additions & 43 deletions

File tree

Alamofire-SwiftyJSON.xcodeproj/project.pbxproj

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,28 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
A82ED83A19ED384500A502B1 /* Alamofire.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A8AFB75A19D14A5C0070765E /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
11+
A82ED83B19ED384900A502B1 /* SwiftyJSON.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A8AFB76519D14A670070765E /* SwiftyJSON.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1012
A8AFB71519D1401D0070765E /* Alamofire-SwiftyJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = A8AFB71419D1401D0070765E /* Alamofire-SwiftyJSON.h */; settings = {ATTRIBUTES = (Public, ); }; };
1113
A8AFB71F19D1401D0070765E /* Alamofire_SwiftyJSONTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8AFB71E19D1401D0070765E /* Alamofire_SwiftyJSONTests.swift */; };
1214
A8AFB72919D140BD0070765E /* Alamofire-SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8AFB72819D140BD0070765E /* Alamofire-SwiftyJSON.swift */; };
1315
/* End PBXBuildFile section */
1416

1517
/* Begin PBXContainerItemProxy section */
18+
A82ED83119ED37BA00A502B1 /* PBXContainerItemProxy */ = {
19+
isa = PBXContainerItemProxy;
20+
containerPortal = A8AFB75419D14A5C0070765E /* Alamofire.xcodeproj */;
21+
proxyType = 1;
22+
remoteGlobalIDString = F8111E3219A95C8B0040E7D1;
23+
remoteInfo = Alamofire;
24+
};
25+
A82ED83719ED37BC00A502B1 /* PBXContainerItemProxy */ = {
26+
isa = PBXContainerItemProxy;
27+
containerPortal = A8AFB75D19D14A670070765E /* SwiftyJSON.xcodeproj */;
28+
proxyType = 1;
29+
remoteGlobalIDString = 2E4FEFDA19575BE100351305;
30+
remoteInfo = SwiftyJSON;
31+
};
1632
A8AFB75919D14A5C0070765E /* PBXContainerItemProxy */ = {
1733
isa = PBXContainerItemProxy;
1834
containerPortal = A8AFB75419D14A5C0070765E /* Alamofire.xcodeproj */;
@@ -41,22 +57,23 @@
4157
remoteGlobalIDString = 2E4FEFE619575BE100351305;
4258
remoteInfo = SwiftyJSONTests;
4359
};
44-
A8AFB76819D14A670070765E /* PBXContainerItemProxy */ = {
45-
isa = PBXContainerItemProxy;
46-
containerPortal = A8AFB75D19D14A670070765E /* SwiftyJSON.xcodeproj */;
47-
proxyType = 2;
48-
remoteGlobalIDString = 2E4FF00219575CE600351305;
49-
remoteInfo = "SwiftyJSON-OSX";
50-
};
51-
A8AFB76A19D14A670070765E /* PBXContainerItemProxy */ = {
52-
isa = PBXContainerItemProxy;
53-
containerPortal = A8AFB75D19D14A670070765E /* SwiftyJSON.xcodeproj */;
54-
proxyType = 2;
55-
remoteGlobalIDString = 2E4FF00C19575CE600351305;
56-
remoteInfo = "SwiftyJSON-OSXTests";
57-
};
5860
/* End PBXContainerItemProxy section */
5961

62+
/* Begin PBXCopyFilesBuildPhase section */
63+
A82ED83919ED37D300A502B1 /* Copy Frameworks */ = {
64+
isa = PBXCopyFilesBuildPhase;
65+
buildActionMask = 2147483647;
66+
dstPath = "";
67+
dstSubfolderSpec = 10;
68+
files = (
69+
A82ED83B19ED384900A502B1 /* SwiftyJSON.framework in Copy Frameworks */,
70+
A82ED83A19ED384500A502B1 /* Alamofire.framework in Copy Frameworks */,
71+
);
72+
name = "Copy Frameworks";
73+
runOnlyForDeploymentPostprocessing = 0;
74+
};
75+
/* End PBXCopyFilesBuildPhase section */
76+
6077
/* Begin PBXFileReference section */
6178
A8AFB70F19D1401D0070765E /* AlamofireSwiftyJSON.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AlamofireSwiftyJSON.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6279
A8AFB71319D1401D0070765E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -156,8 +173,6 @@
156173
children = (
157174
A8AFB76519D14A670070765E /* SwiftyJSON.framework */,
158175
A8AFB76719D14A670070765E /* SwiftyJSONTests.xctest */,
159-
A8AFB76919D14A670070765E /* SwiftyJSON.framework */,
160-
A8AFB76B19D14A670070765E /* SwiftyJSON-OSXTests.xctest */,
161176
);
162177
name = Products;
163178
sourceTree = "<group>";
@@ -184,10 +199,13 @@
184199
A8AFB70B19D1401D0070765E /* Frameworks */,
185200
A8AFB70C19D1401D0070765E /* Headers */,
186201
A8AFB70D19D1401D0070765E /* Resources */,
202+
A82ED83919ED37D300A502B1 /* Copy Frameworks */,
187203
);
188204
buildRules = (
189205
);
190206
dependencies = (
207+
A82ED83819ED37BC00A502B1 /* PBXTargetDependency */,
208+
A82ED83219ED37BA00A502B1 /* PBXTargetDependency */,
191209
);
192210
name = AlamofireSwiftyJSON;
193211
productName = "Alamofire-SwiftyJSON";
@@ -285,20 +303,6 @@
285303
remoteRef = A8AFB76619D14A670070765E /* PBXContainerItemProxy */;
286304
sourceTree = BUILT_PRODUCTS_DIR;
287305
};
288-
A8AFB76919D14A670070765E /* SwiftyJSON.framework */ = {
289-
isa = PBXReferenceProxy;
290-
fileType = wrapper.framework;
291-
path = SwiftyJSON.framework;
292-
remoteRef = A8AFB76819D14A670070765E /* PBXContainerItemProxy */;
293-
sourceTree = BUILT_PRODUCTS_DIR;
294-
};
295-
A8AFB76B19D14A670070765E /* SwiftyJSON-OSXTests.xctest */ = {
296-
isa = PBXReferenceProxy;
297-
fileType = wrapper.cfbundle;
298-
path = "SwiftyJSON-OSXTests.xctest";
299-
remoteRef = A8AFB76A19D14A670070765E /* PBXContainerItemProxy */;
300-
sourceTree = BUILT_PRODUCTS_DIR;
301-
};
302306
/* End PBXReferenceProxy section */
303307

304308
/* Begin PBXResourcesBuildPhase section */
@@ -337,6 +341,19 @@
337341
};
338342
/* End PBXSourcesBuildPhase section */
339343

344+
/* Begin PBXTargetDependency section */
345+
A82ED83219ED37BA00A502B1 /* PBXTargetDependency */ = {
346+
isa = PBXTargetDependency;
347+
name = Alamofire;
348+
targetProxy = A82ED83119ED37BA00A502B1 /* PBXContainerItemProxy */;
349+
};
350+
A82ED83819ED37BC00A502B1 /* PBXTargetDependency */ = {
351+
isa = PBXTargetDependency;
352+
name = SwiftyJSON;
353+
targetProxy = A82ED83719ED37BC00A502B1 /* PBXContainerItemProxy */;
354+
};
355+
/* End PBXTargetDependency section */
356+
340357
/* Begin XCBuildConfiguration section */
341358
A8AFB72019D1401D0070765E /* Debug */ = {
342359
isa = XCBuildConfiguration;

Source/Alamofire-SwiftyJSON.swift

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// AlamofireSwiftyJSON
44
//
55
// Created by Pinglin Tang on 14-9-22.
6-
// Copyright (c) 2014年 swiftyJSON. All rights reserved.
6+
// Copyright (c) 2014 SwiftyJSON. All rights reserved.
77
//
88

99
import Foundation
@@ -23,32 +23,31 @@ extension Alamofire.Request {
2323
:returns: The request.
2424
*/
2525
public func responseSwiftyJSON(completionHandler: (NSURLRequest, NSHTTPURLResponse?, SwiftyJSON.JSON, NSError?) -> Void) -> Self {
26-
return responseSwiftyJSON(completionHandler: completionHandler)
26+
return responseSwiftyJSON(queue:nil, options:NSJSONReadingOptions.AllowFragments, completionHandler:completionHandler)
2727
}
2828

2929
/**
3030
Adds a handler to be called once the request has finished.
3131

32-
:param: priority The dispatch priority / quality of service used to process the response handler. `DISPATCH_QUEUE_PRIORITY_DEFAULT` by default.
3332
:param: queue The queue on which the completion handler is dispatched.
3433
:param: options The JSON serialization reading options. `.AllowFragments` by default.
3534
:param: completionHandler A closure to be executed once the request has finished. The closure takes 4 arguments: the URL request, the URL response, if one was received, the SwiftyJSON enum, if one could be created from the URL response and data, and any error produced while creating the SwiftyJSON enum.
3635

3736
:returns: The request.
3837
*/
39-
public func responseSwiftyJSON(priority: Int = DISPATCH_QUEUE_PRIORITY_DEFAULT, queue: dispatch_queue_t? = nil, options: NSJSONReadingOptions = .AllowFragments, completionHandler: (NSURLRequest, NSHTTPURLResponse?, SwiftyJSON.JSON, NSError?) -> Void) -> Self {
38+
public func responseSwiftyJSON(queue: dispatch_queue_t? = nil, options: NSJSONReadingOptions = .AllowFragments, completionHandler: (NSURLRequest, NSHTTPURLResponse?, SwiftyJSON.JSON, NSError?) -> Void) -> Self {
4039

41-
return response(priority: priority, queue: queue, serializer: Alamofire.Request.JSONResponseSerializer(options: options), completionHandler: { (request, response, object, error) in
42-
dispatch_async(dispatch_get_global_queue(priority, 0), {
40+
return response(queue: queue, serializer: Alamofire.Request.JSONResponseSerializer(options: options), completionHandler: { (request, response, object, error) -> Void in
41+
42+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
4343

4444
var responseJSON: SwiftyJSON.JSON
45-
4645
if error != nil {
47-
responseJSON = SwiftyJSON.JSON.Null(error)
46+
responseJSON = SwiftyJSON.JSON.nullJSON
4847
} else if object != nil {
49-
responseJSON = SwiftyJSON.JSON(object: object!)
48+
responseJSON = SwiftyJSON.JSON(object!)
5049
} else {
51-
responseJSON = SwiftyJSON.JSON.Null(nil)
50+
responseJSON = SwiftyJSON.JSON.nullJSON
5251
}
5352

5453
dispatch_async(queue ?? dispatch_get_main_queue(), {

Tests/Alamofire_SwiftyJSONTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Alamofire_SwiftyJSONTests: XCTestCase {
2424
XCTAssertNotNil(request, "request should not be nil")
2525
XCTAssertNotNil(response, "response should not be nil")
2626
XCTAssertNil(error, "error should be nil")
27-
XCTAssertEqual(responseJSON["args"], SwiftyJSON.JSON(object: ["foo": "bar"] as NSDictionary), "args should be equal")
27+
XCTAssertEqual(responseJSON["args"], SwiftyJSON.JSON(["foo": "bar"] as NSDictionary), "args should be equal")
2828
}
2929

3030
waitForExpectationsWithTimeout(10) { (error) in

0 commit comments

Comments
 (0)