Skip to content

Commit 0eaebe1

Browse files
committed
Update starter projects to use configuration-based initialization API.
1 parent 2f70f59 commit 0eaebe1

File tree

7 files changed

+114
-45
lines changed

7 files changed

+114
-45
lines changed

ParseStarterProject/OSX/ParseOSXStarterProject-Swift/ParseOSXStarterProject/AppDelegate.swift

+16-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,25 @@ class AppDelegate: NSObject, NSApplicationDelegate {
1717
@IBOutlet weak var window: NSWindow?
1818

1919
func applicationDidFinishLaunching(aNotification: NSNotification) {
20-
// Enable storing and querying data from Local Datastore.
21-
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
22-
Parse.enableLocalDatastore()
23-
2420
// ****************************************************************************
25-
// Uncomment and fill in with your Parse credentials:
26-
// Parse.setApplicationId("your_application_id", clientKey: "your_client_key")
21+
// Initialize Parse SDK
2722
// ****************************************************************************
2823

24+
let configuration = ParseClientConfiguration {
25+
// Add your Parse applicationId:
26+
$0.applicationId = "your_application_id"
27+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
28+
$0.clientKey = "your_client_key"
29+
30+
// Uncomment the following line and change to your Parse Server address;
31+
$0.server = "https://YOUR_PARSE_SERVER/parse"
32+
33+
// Enable storing and querying data from Local Datastore.
34+
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
35+
$0.localDatastoreEnabled = true
36+
}
37+
Parse.initializeWithConfiguration(configuration)
38+
2939
PFUser.enableAutomaticUser()
3040

3141
let defaultACL: PFACL = PFACL()

ParseStarterProject/OSX/ParseOSXStarterProject/ParseOSXStarterProject/AppDelegate.m

+16-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,25 @@ @implementation AppDelegate
1717
#pragma mark NSApplicationDelegate
1818

1919
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
20-
// Enable storing and querying data from Local Datastore.
21-
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
22-
[Parse enableLocalDatastore];
23-
2420
// ****************************************************************************
25-
// Uncomment and fill in with your Parse credentials:
26-
// [Parse setApplicationId:@"your_application_id" clientKey:@"your_client_key"];
21+
// Initialize Parse SDK
2722
// ****************************************************************************
2823

24+
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> _Nonnull configuration) {
25+
// Add your Parse applicationId:
26+
configuration.applicationId = @"your_application_id";
27+
28+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
29+
// configuration.clientKey = @"your_client_key";
30+
31+
// Uncomment the following line and change to your Parse Server address;
32+
// configuration.server = @"https://YOUR_PARSE_SERVER/parse";
33+
34+
// Enable storing and querying data from Local Datastore. Remove this line if you don't want to
35+
// use Local Datastore features or want to use cachePolicy.
36+
configuration.localDatastoreEnabled = YES;
37+
}]];
38+
2939
[PFUser enableAutomaticUser];
3040

3141
PFACL *defaultACL = [PFACL ACL];

ParseStarterProject/iOS/ParseStarterProject-Swift/ParseStarterProject/AppDelegate.swift

+18-6
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2424
//--------------------------------------
2525

2626
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
27-
// Enable storing and querying data from Local Datastore.
28-
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
29-
Parse.enableLocalDatastore()
27+
// ****************************************************************************
28+
// Initialize Parse SDK
29+
// ****************************************************************************
30+
31+
let configuration = ParseClientConfiguration {
32+
// Add your Parse applicationId:
33+
$0.applicationId = "your_application_id"
34+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
35+
$0.clientKey = "your_client_key"
36+
37+
// Uncomment the following line and change to your Parse Server address;
38+
$0.server = "https://YOUR_PARSE_SERVER/parse"
39+
40+
// Enable storing and querying data from Local Datastore.
41+
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
42+
$0.localDatastoreEnabled = true
43+
}
44+
Parse.initializeWithConfiguration(configuration)
3045

3146
// ****************************************************************************
32-
// Uncomment and fill in with your Parse credentials:
33-
// Parse.setApplicationId("your_application_id", clientKey: "your_client_key")
34-
//
3547
// If you are using Facebook, uncomment and add your FacebookAppID to your bundle's plist as
3648
// described here: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/
3749
// Uncomment the line inside ParseStartProject-Bridging-Header and the following line here:

ParseStarterProject/iOS/ParseStarterProject/ParseStarterProject/ParseStarterProjectAppDelegate.m

+18-6
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,26 @@ @implementation ParseStarterProjectAppDelegate
2424
#pragma mark UIApplicationDelegate
2525

2626
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
27-
// Enable storing and querying data from Local Datastore. Remove this line if you don't want to
28-
// use Local Datastore features or want to use cachePolicy.
29-
[Parse enableLocalDatastore];
27+
// ****************************************************************************
28+
// Initialize Parse SDK
29+
// ****************************************************************************
30+
31+
[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> _Nonnull configuration) {
32+
// Add your Parse applicationId:
33+
configuration.applicationId = @"your_application_id";
34+
35+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
36+
// configuration.clientKey = @"your_client_key";
37+
38+
// Uncomment the following line and change to your Parse Server address;
39+
// configuration.server = @"https://YOUR_PARSE_SERVER/parse";
40+
41+
// Enable storing and querying data from Local Datastore. Remove this line if you don't want to
42+
// use Local Datastore features or want to use cachePolicy.
43+
configuration.localDatastoreEnabled = YES;
44+
}]];
3045

3146
// ****************************************************************************
32-
// Uncomment and fill in with your Parse credentials:
33-
// [Parse setApplicationId:@"your_application_id" clientKey:@"your_client_key"];
34-
//
3547
// If you are using Facebook, uncomment and add your FacebookAppID to your bundle's plist as
3648
// described here: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/
3749
// [PFFacebookUtils initializeFacebook];

ParseStarterProject/tvOS/ParseStarterProject-Swift/ParseStarter/AppDelegate.swift

+12-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2222

2323
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
2424
// ****************************************************************************
25-
//
26-
// Uncomment and fill in with your Parse credentials:
27-
// Parse.setApplicationId("your_application_id", clientKey: "your_client_key")
28-
//
25+
// Initialize Parse SDK
2926
// ****************************************************************************
3027

28+
let configuration = ParseClientConfiguration {
29+
// Add your Parse applicationId:
30+
$0.applicationId = "your_application_id"
31+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
32+
$0.clientKey = "your_client_key"
33+
34+
// Uncomment the following line and change to your Parse Server address;
35+
$0.server = "https://YOUR_PARSE_SERVER/parse"
36+
}
37+
Parse.initializeWithConfiguration(configuration)
38+
3139
PFUser.enableAutomaticUser()
3240

3341
let defaultACL = PFACL()

ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter Extension/ExtensionDelegate.swift

+18-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,24 @@ import Parse
1313
class ExtensionDelegate: NSObject, WKExtensionDelegate {
1414

1515
func applicationDidFinishLaunching() {
16-
// Enable storing and querying data from Local Datastore.
17-
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
18-
Parse.enableLocalDatastore()
19-
20-
// Make sure to replace with your Parse app credentials:
21-
Parse.setApplicationId("your_application_id", clientKey: "your_client_key")
16+
// ****************************************************************************
17+
// Initialize Parse SDK
18+
// ****************************************************************************
19+
20+
let configuration = ParseClientConfiguration {
21+
// Add your Parse applicationId:
22+
$0.applicationId = "your_application_id"
23+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
24+
$0.clientKey = "your_client_key"
25+
26+
// Uncomment the following line and change to your Parse Server address;
27+
$0.server = "https://YOUR_PARSE_SERVER/parse"
28+
29+
// Enable storing and querying data from Local Datastore.
30+
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
31+
$0.localDatastoreEnabled = true
32+
}
33+
Parse.initializeWithConfiguration(configuration)
2234

2335
// Track application opened event in Analytics
2436
PFAnalytics.trackAppOpenedWithLaunchOptions(nil)

ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarterProject/AppDelegate.swift

+16-11
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2424
//--------------------------------------
2525

2626
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
27-
// Enable storing and querying data from Local Datastore.
28-
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
29-
Parse.enableLocalDatastore()
30-
3127
// ****************************************************************************
32-
// Uncomment and fill in with your Parse credentials:
33-
// Parse.setApplicationId("your_application_id", clientKey: "your_client_key")
34-
//
35-
// If you are using Facebook, uncomment and add your FacebookAppID to your bundle's plist as
36-
// described here: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/
37-
// Uncomment the line inside ParseStartProject-Bridging-Header and the following line here:
38-
// PFFacebookUtils.initializeFacebook()
28+
// Initialize Parse SDK
3929
// ****************************************************************************
4030

31+
let configuration = ParseClientConfiguration {
32+
// Add your Parse applicationId:
33+
$0.applicationId = "your_application_id"
34+
// Uncomment and add your clientKey (it's not required if you are using Parse Server):
35+
$0.clientKey = "your_client_key"
36+
37+
// Uncomment the following line and change to your Parse Server address;
38+
$0.server = "https://YOUR_PARSE_SERVER/parse"
39+
40+
// Enable storing and querying data from Local Datastore.
41+
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
42+
$0.localDatastoreEnabled = true
43+
}
44+
Parse.initializeWithConfiguration(configuration)
45+
4146
PFUser.enableAutomaticUser()
4247

4348
let defaultACL = PFACL()

0 commit comments

Comments
 (0)