Skip to content

Instantly share code, notes, and snippets.

@fumiyasac
Last active December 30, 2015 01:23
Show Gist options
  • Save fumiyasac/4ac45b2304a6d3f02fdf to your computer and use it in GitHub Desktop.
Save fumiyasac/4ac45b2304a6d3f02fdf to your computer and use it in GitHub Desktop.
Swift2系でParse.comを利用したサンプルアプリ(Chapter1:導入と疎通の確認まで) ref: http://qiita.com/fumiyasac@github/items/5f0e77728221aade5027
//先頭に追加したフレームワークのクラスをインポート宣言
import Parse
import Bolts
(※途中省略)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// ----- 追加 ここから↓ -----
// [Optional] Power your app with Local Datastore. For more info, go to
// https://parse.com/docs/ios_guide#localdatastore/iOS
Parse.enableLocalDatastore()
//※ここをみなさんのアカウントのやつにしてください
// Initialize Parse.
Parse.setApplicationId("Application ID",
clientKey: "Client key")
// [Optional] Track statistics around application opens.
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
// ----- 追加 ここまで↑ -----
// Override point for customization after application launch.
return true
}
$ git clone git@github.com:fumiyasac/PremiumCafeList.git
$ git checkout afaef4f0c6fbc877267a76ad9f475bf927dd58bd
//先頭に追加したフレームワークのクラスをインポート宣言
import Parse
(※途中省略)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//Parseテスト用のコード(Object has been saved.がコンソールに表示されれば通信が成功)
let testObject = PFObject(className: "TestObject")
testObject["testKey"] = "testValue"
testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
print("Object has been saved.")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment