From cbaecb312c9a8c9fed7609d62a4b49008cfd0040 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Tue, 8 Mar 2016 19:33:01 -0800 Subject: [PATCH] Require clientKey for old SDK initialization API. --- Parse/Parse.m | 1 + Tests/Unit/ParseSetupUnitTests.m | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Parse/Parse.m b/Parse/Parse.m index a46983e71..d311de24b 100644 --- a/Parse/Parse.m +++ b/Parse/Parse.m @@ -54,6 +54,7 @@ + (void)initialize { ///-------------------------------------- + (void)setApplicationId:(NSString *)applicationId clientKey:(NSString *)clientKey { + PFParameterAssert(clientKey.length, @"`clientKey` should not be nil."); currentParseConfiguration_.applicationId = applicationId; currentParseConfiguration_.clientKey = clientKey; currentParseConfiguration_.server = [PFInternalUtils parseServerURLString]; // TODO: (nlutsenko) Clean this up after tests are updated. diff --git a/Tests/Unit/ParseSetupUnitTests.m b/Tests/Unit/ParseSetupUnitTests.m index f89f533fa..984b4eae0 100644 --- a/Tests/Unit/ParseSetupUnitTests.m +++ b/Tests/Unit/ParseSetupUnitTests.m @@ -50,10 +50,7 @@ - (void)testInitializeWithNilApplicationIdShouldThrowException { NSString *yolo = nil; PFAssertThrowsInvalidArgumentException([Parse setApplicationId:yolo clientKey:yolo]); PFAssertThrowsInvalidArgumentException([Parse setApplicationId:yolo clientKey:@"a"]); -} - -- (void)testInitializeWithoutClientKeyNoThrow { - XCTAssertNoThrow([Parse setApplicationId:@"a" clientKey:nil]); + PFAssertThrowsInvalidArgumentException([Parse setApplicationId:@"a" clientKey:yolo]); } @end