Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit a2471e2

Browse files
committed
Merge pull request #3 from ParsePlatform/nlutsenko.1130
Fix usage of non-optional Parse.currentConfiguration().
2 parents 7bf5c5e + b324c4f commit a2471e2

File tree

6 files changed

+103
-26
lines changed

6 files changed

+103
-26
lines changed

Examples/LiveQueryDemo.xcodeproj/project.pbxproj

+69-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,36 @@
88

99
/* Begin PBXBuildFile section */
1010
7F64F07377979A28C88AF3AE /* Pods_LiveQueryDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6A6F02FD57E57309877DA38 /* Pods_LiveQueryDemo.framework */; };
11+
8199A4091CA1EF3300BF61E1 /* ParseLiveQuery.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8199A4061CA1EF1800BF61E1 /* ParseLiveQuery.framework */; };
1112
F59F85B01C9BB48200566A29 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59F85AF1C9BB48200566A29 /* main.swift */; };
1213
F59F85B81C9BB4B600566A29 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59F85B61C9BB4B600566A29 /* Message.swift */; };
1314
F59F85B91C9BB4B600566A29 /* Room.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59F85B71C9BB4B600566A29 /* Room.swift */; };
14-
F59F85BD1C9BB66C00566A29 /* ParseLiveQuery.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F59F85BC1C9BB66C00566A29 /* ParseLiveQuery.framework */; };
1515
/* End PBXBuildFile section */
1616

17+
/* Begin PBXContainerItemProxy section */
18+
8199A4031CA1EF1800BF61E1 /* PBXContainerItemProxy */ = {
19+
isa = PBXContainerItemProxy;
20+
containerPortal = 8199A3FE1CA1EF1800BF61E1 /* ParseLiveQuery.xcodeproj */;
21+
proxyType = 2;
22+
remoteGlobalIDString = F5A9BFCA1BE0248D00E78326;
23+
remoteInfo = "ParseLiveQuery-iOS";
24+
};
25+
8199A4051CA1EF1800BF61E1 /* PBXContainerItemProxy */ = {
26+
isa = PBXContainerItemProxy;
27+
containerPortal = 8199A3FE1CA1EF1800BF61E1 /* ParseLiveQuery.xcodeproj */;
28+
proxyType = 2;
29+
remoteGlobalIDString = F5903CEA1BD999C500C3EFFE;
30+
remoteInfo = "ParseLiveQuery-OSX";
31+
};
32+
8199A4071CA1EF2100BF61E1 /* PBXContainerItemProxy */ = {
33+
isa = PBXContainerItemProxy;
34+
containerPortal = 8199A3FE1CA1EF1800BF61E1 /* ParseLiveQuery.xcodeproj */;
35+
proxyType = 1;
36+
remoteGlobalIDString = F5903CE91BD999C500C3EFFE;
37+
remoteInfo = "ParseLiveQuery-OSX";
38+
};
39+
/* End PBXContainerItemProxy section */
40+
1741
/* Begin PBXCopyFilesBuildPhase section */
1842
F59F85AA1C9BB48200566A29 /* CopyFiles */ = {
1943
isa = PBXCopyFilesBuildPhase;
@@ -29,6 +53,7 @@
2953
/* Begin PBXFileReference section */
3054
3AC9312CEDA0007F8EAA9880 /* Pods-LiveQueryDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LiveQueryDemo.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-LiveQueryDemo/Pods-LiveQueryDemo.debug.xcconfig"; sourceTree = "<group>"; };
3155
497772719B97C861F0896BFC /* Pods-LiveQueryDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LiveQueryDemo.release.xcconfig"; path = "../Pods/Target Support Files/Pods-LiveQueryDemo/Pods-LiveQueryDemo.release.xcconfig"; sourceTree = "<group>"; };
56+
8199A3FE1CA1EF1800BF61E1 /* ParseLiveQuery.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ParseLiveQuery.xcodeproj; path = ../Sources/ParseLiveQuery.xcodeproj; sourceTree = "<group>"; };
3257
E6A6F02FD57E57309877DA38 /* Pods_LiveQueryDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LiveQueryDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3358
F59F85AC1C9BB48200566A29 /* LiveQueryDemo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = LiveQueryDemo; sourceTree = BUILT_PRODUCTS_DIR; };
3459
F59F85AF1C9BB48200566A29 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
@@ -42,7 +67,7 @@
4267
isa = PBXFrameworksBuildPhase;
4368
buildActionMask = 2147483647;
4469
files = (
45-
F59F85BD1C9BB66C00566A29 /* ParseLiveQuery.framework in Frameworks */,
70+
8199A4091CA1EF3300BF61E1 /* ParseLiveQuery.framework in Frameworks */,
4671
7F64F07377979A28C88AF3AE /* Pods_LiveQueryDemo.framework in Frameworks */,
4772
);
4873
runOnlyForDeploymentPostprocessing = 0;
@@ -53,12 +78,22 @@
5378
2E2DAD338FCB65EC95CB7AA9 /* Frameworks */ = {
5479
isa = PBXGroup;
5580
children = (
81+
8199A3FE1CA1EF1800BF61E1 /* ParseLiveQuery.xcodeproj */,
5682
F59F85BC1C9BB66C00566A29 /* ParseLiveQuery.framework */,
5783
E6A6F02FD57E57309877DA38 /* Pods_LiveQueryDemo.framework */,
5884
);
5985
name = Frameworks;
6086
sourceTree = "<group>";
6187
};
88+
8199A3FF1CA1EF1800BF61E1 /* Products */ = {
89+
isa = PBXGroup;
90+
children = (
91+
8199A4041CA1EF1800BF61E1 /* ParseLiveQuery.framework */,
92+
8199A4061CA1EF1800BF61E1 /* ParseLiveQuery.framework */,
93+
);
94+
name = Products;
95+
sourceTree = "<group>";
96+
};
6297
B4367C9D9257525F9D28B542 /* Pods */ = {
6398
isa = PBXGroup;
6499
children = (
@@ -114,6 +149,7 @@
114149
buildRules = (
115150
);
116151
dependencies = (
152+
8199A4081CA1EF2100BF61E1 /* PBXTargetDependency */,
117153
);
118154
name = LiveQueryDemo;
119155
productName = LiveQueryDemo;
@@ -145,13 +181,36 @@
145181
mainGroup = F59F85A31C9BB48200566A29;
146182
productRefGroup = F59F85AD1C9BB48200566A29 /* Products */;
147183
projectDirPath = "";
184+
projectReferences = (
185+
{
186+
ProductGroup = 8199A3FF1CA1EF1800BF61E1 /* Products */;
187+
ProjectRef = 8199A3FE1CA1EF1800BF61E1 /* ParseLiveQuery.xcodeproj */;
188+
},
189+
);
148190
projectRoot = "";
149191
targets = (
150192
F59F85AB1C9BB48200566A29 /* LiveQueryDemo */,
151193
);
152194
};
153195
/* End PBXProject section */
154196

197+
/* Begin PBXReferenceProxy section */
198+
8199A4041CA1EF1800BF61E1 /* ParseLiveQuery.framework */ = {
199+
isa = PBXReferenceProxy;
200+
fileType = wrapper.framework;
201+
path = ParseLiveQuery.framework;
202+
remoteRef = 8199A4031CA1EF1800BF61E1 /* PBXContainerItemProxy */;
203+
sourceTree = BUILT_PRODUCTS_DIR;
204+
};
205+
8199A4061CA1EF1800BF61E1 /* ParseLiveQuery.framework */ = {
206+
isa = PBXReferenceProxy;
207+
fileType = wrapper.framework;
208+
path = ParseLiveQuery.framework;
209+
remoteRef = 8199A4051CA1EF1800BF61E1 /* PBXContainerItemProxy */;
210+
sourceTree = BUILT_PRODUCTS_DIR;
211+
};
212+
/* End PBXReferenceProxy section */
213+
155214
/* Begin PBXShellScriptBuildPhase section */
156215
15BD0AAA808A79D4D9BF001B /* 📦 Check Pods Manifest.lock */ = {
157216
isa = PBXShellScriptBuildPhase;
@@ -198,6 +257,14 @@
198257
};
199258
/* End PBXSourcesBuildPhase section */
200259

260+
/* Begin PBXTargetDependency section */
261+
8199A4081CA1EF2100BF61E1 /* PBXTargetDependency */ = {
262+
isa = PBXTargetDependency;
263+
name = "ParseLiveQuery-OSX";
264+
targetProxy = 8199A4071CA1EF2100BF61E1 /* PBXContainerItemProxy */;
265+
};
266+
/* End PBXTargetDependency section */
267+
201268
/* Begin XCBuildConfiguration section */
202269
F59F85B11C9BB48200566A29 /* Debug */ = {
203270
isa = XCBuildConfiguration;

Examples/LiveQueryDemo.xcodeproj/xcshareddata/xcschemes/LiveQueryDemo.xcscheme

+1-15
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,9 @@
33
LastUpgradeVersion = "0720"
44
version = "1.3">
55
<BuildAction
6-
parallelizeBuildables = "NO"
6+
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
88
<BuildActionEntries>
9-
<BuildActionEntry
10-
buildForTesting = "YES"
11-
buildForRunning = "YES"
12-
buildForProfiling = "YES"
13-
buildForArchiving = "YES"
14-
buildForAnalyzing = "YES">
15-
<BuildableReference
16-
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "F5903CE91BD999C500C3EFFE"
18-
BuildableName = "ParseLiveQuery.framework"
19-
BlueprintName = "ParseLiveQuery-OSX"
20-
ReferencedContainer = "container:../Sources/ParseLiveQuery.xcodeproj">
21-
</BuildableReference>
22-
</BuildActionEntry>
239
<BuildActionEntry
2410
buildForTesting = "YES"
2511
buildForRunning = "YES"

Podfile.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PODS:
22
- Bolts-Swift (1.0.0)
33
- Bolts/Tasks (1.6.0)
4-
- Parse (1.12.0):
5-
- Bolts/Tasks (~> 1.5)
4+
- Parse (1.13.0):
5+
- Bolts/Tasks (~> 1.6)
66
- SocketRocket (0.5.0)
77

88
DEPENDENCIES:
@@ -13,7 +13,7 @@ DEPENDENCIES:
1313
SPEC CHECKSUMS:
1414
Bolts: f52a250053bb517ca874523c3913776359ab3def
1515
Bolts-Swift: 1b20170f1edf3568ec62142ea16ecdc369deced7
16-
Parse: de2c52a9a1421b91ae7594ab8ce191afd184f19b
16+
Parse: f51c24d2feb412e4b2d6cc73d37cb24e8d0089bc
1717
SocketRocket: 2c51efccd2d73c99a923407ca4b06e7e9da95dbf
1818

1919
PODFILE CHECKSUM: b9a8e3333816abb217972f59b02783395bc8c2e2

Sources/ParseLiveQuery.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0632EDD41CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0632EDD31CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift */; };
11+
0632EDD51CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0632EDD31CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift */; };
1012
629DC3BE90DA87A7857677D2 /* Pods_ParseLiveQuery_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE2643D85A7565FC20EE144C /* Pods_ParseLiveQuery_iOS.framework */; };
1113
DE7126BDB27E5DDB1C21490A /* Pods_ParseLiveQuery_OSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF5A55E51D52E372CD28FF08 /* Pods_ParseLiveQuery_OSX.framework */; };
1214
F534A5B21BDAFE0200CBD11A /* Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = F534A5B11BDAFE0200CBD11A /* Subscription.swift */; };
@@ -30,6 +32,7 @@
3032
/* End PBXBuildFile section */
3133

3234
/* Begin PBXFileReference section */
35+
0632EDD31CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Parse+LiveQuery.swift"; sourceTree = "<group>"; };
3336
11F6DFE2732DB0DE49976BA5 /* Pods-ParseLiveQuery OSX.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery OSX.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery OSX/Pods-ParseLiveQuery OSX.release.xcconfig"; sourceTree = "<group>"; };
3437
6062D7994653A4F07D1358B9 /* Pods-ParseLiveQuery iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery iOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery iOS/Pods-ParseLiveQuery iOS.debug.xcconfig"; sourceTree = "<group>"; };
3538
7A40A16386D0D6B38F8B2F07 /* Pods-ParseLiveQuery-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ParseLiveQuery-iOS.release.xcconfig"; path = "../Pods/Target Support Files/Pods-ParseLiveQuery-iOS/Pods-ParseLiveQuery-iOS.release.xcconfig"; sourceTree = "<group>"; };
@@ -128,6 +131,7 @@
128131
F534A5B11BDAFE0200CBD11A /* Subscription.swift */,
129132
F54D58B51C8E33D9009F8D6C /* ObjCCompat.swift */,
130133
F59CA92E1C8E496200329737 /* Errors.swift */,
134+
0632EDD31CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift */,
131135
F5A88F491C9B6EBA002F0E0D /* PFQuery+Subscribe.swift */,
132136
);
133137
path = ParseLiveQuery;
@@ -324,6 +328,7 @@
324328
files = (
325329
F54D58B81C8E3446009F8D6C /* ClientPrivate.swift in Sources */,
326330
F5D965351BD99DA200C3AAFC /* Client.swift in Sources */,
331+
0632EDD51CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift in Sources */,
327332
F54D58B61C8E33D9009F8D6C /* ObjCCompat.swift in Sources */,
328333
F54D58BA1C8E345F009F8D6C /* BoltsHelpers.swift in Sources */,
329334
F5D965381BD99DA200C3AAFC /* QueryEncoder.swift in Sources */,
@@ -340,6 +345,7 @@
340345
files = (
341346
F5A88F541C9B7341002F0E0D /* ObjCCompat.swift in Sources */,
342347
F5A88F531C9B7341002F0E0D /* Subscription.swift in Sources */,
348+
0632EDD41CA1A6DB00DD3CB8 /* Parse+LiveQuery.swift in Sources */,
343349
F5A88F511C9B7341002F0E0D /* BoltsHelpers.swift in Sources */,
344350
F5A88F501C9B7341002F0E0D /* ClientPrivate.swift in Sources */,
345351
F5A88F551C9B7341002F0E0D /* Errors.swift in Sources */,

Sources/ParseLiveQuery/Client.swift

+5-6
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ public class Client: NSObject {
3333
internal let queue = dispatch_queue_create("com.parse.livequery", DISPATCH_QUEUE_SERIAL)
3434

3535
/**
36-
Creates a Client which automatically attempts to connect to the custom parse-server URL set
37-
in Parse.currentConfiguration
36+
Creates a Client which automatically attempts to connect to the custom parse-server URL set in Parse.currentConfiguration().
3837
*/
3938
public override convenience init() {
40-
self.init(server: Parse.currentConfiguration().server)
39+
self.init(server: Parse.validatedCurrentConfiguration().server)
4140
}
4241

4342
/**
@@ -61,8 +60,8 @@ public class Client: NSObject {
6160
return RequestId(value: currentRequestId)
6261
}
6362

64-
self.applicationId = applicationId ?? Parse.currentConfiguration().applicationId!
65-
self.clientKey = clientKey ?? Parse.currentConfiguration().clientKey
63+
self.applicationId = applicationId ?? Parse.validatedCurrentConfiguration().applicationId!
64+
self.clientKey = clientKey ?? Parse.validatedCurrentConfiguration().clientKey
6665

6766
self.host = components.URL!
6867
}
@@ -94,7 +93,7 @@ extension Client {
9493
dispatch_sync(storage.queue) {
9594
client = storage.client
9695
if client == nil {
97-
let configuration = Parse.currentConfiguration()
96+
let configuration = Parse.validatedCurrentConfiguration()
9897
client = Client(
9998
server: configuration.server,
10099
applicationId: configuration.applicationId,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) 2016-present, Parse, LLC.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
import Parse
11+
12+
extension Parse {
13+
static func validatedCurrentConfiguration() -> ParseClientConfiguration {
14+
guard let configuration = Parse.currentConfiguration() else {
15+
preconditionFailure("Parse SDK is not initialized. Call Parse.initializeWithConfiguration() before loading live query client.")
16+
}
17+
return configuration
18+
}
19+
}

0 commit comments

Comments
 (0)