Save 37% off PRO during our Black Friday Sale! »

NCMB SDK 各プラットフォームの違いを探る / ncmb sdk

NCMB SDK 各プラットフォームの違いを探る / ncmb sdk

2017年2月7日に開催されたNCMB-UG rebuildで発表した資料です。

83f9862ef4599c97e99d020eb8e20d87?s=128

KOYAMA Tetsuji

February 07, 2017
Tweet

Transcript

  1. /$.#4%, ֤ϓϥοτϑΥʔϜͷҧ͍Λ୳Δ NCMBΤόϯδΣϦετ খࢁ఩ࢤ 2017-02-07 NCMB-UG rebuild

  2. ࢲ͸୭ • খࢁ఩ࢤ (koyhoge) • 2015೥5݄ΑΓNCMBΤόϯδΣϦετ • http://koyhogetech.hatenablog.com/entry/20150507/ ncmb •

    ೔ຊUNIXϢʔβձɺ೔ຊPostgreSQLϢʔβձɺ೔ຊPHP ϢʔβձʹؔΘΔ • NCMB Android SDK v2 ͷॳظ։ൃʹࢀՃ
  3. /$.#4%, • ֤ݴޠɺϓϥοτϑΥʔϜຖʹ༻ҙ͞Ε͍ͯΔ • ެࣜ͸ҎԼͷ4ͭ • Objective-C (iOS) • Java

    (Android) • JavaScript (node, Monaca) • C# (Unity)
  4. ݴޠ͝ͱͷҧ͍͸Ͳͷ͘Β͍ • ֤ݴޠͰͰ͖Δ͜ͱ͕ҧ͏ • ϓϥοτϑΥʔϜಛ༗ͷ࡞๏΋͋Δ • ओཁػೳʹର֤ͯ͠SDKͷҧ͍Λݟ͍ͯ͘ • ॳظԽ •

    σʔλετΞ • ϢʔβϩάΠϯ • ACL
  5. ॳظԽ J04 "OESPJE • iOS • Android [NCMB setApplicationKey:@"API_KEY", clientKey:@"CLIENT_KEY"];

    public class MainActivity extends AppComaptActivity { @override protected void onCreate(Bundle savedInstanceState) { // <省略> NCMB.initialize(this, "API_KEY", "CLIENT_KEY"); }
  6. ॳظԽ +BWB4DSJQU 6OJUZ • JavaScript • Unity • ॳظԽ͸SDK಺ͰࣗಈͰߦΘΕΔɻAPP_KEY, CLIENT_KEY

    ͸GUIઃఆύωϧNCMBSettingsʹ ొ࿥ɻ var NCMB = NCMB || require("./lib/ncmb"); var ncmb = new NCMB("API_KEY", "CLIENT_KEY");
  7. σʔλετΞ J04 NCMBObject *obj = [NCMBObject objectWithClassName:@“MyClass”]; [obj setObject:@"value" forKey:@"keyname"];

    [obj saveInBackgroundWithBlock:^(NSError *error) { if (error) { // 失敗処理 } else { // 成功処理 } }];
  8. σʔλετΞ "OESPJE NCMBObject obj = new NCMBObject("MyClass"); obj.put("keyname", "value"); obj.saveInBackground(new

    DoneCallback() { @override public void done(NCMBException e) { if (e != null) { // 失敗処理 } else { // 成功処理 } } });
  9. σʔλετΞ +BWB4DSJQU var MyClass = ncmb.DataStore("MyClass"); var obj = new

    MyClass({keyname: "value"}); obj.save() .then(function(result) { // 成功処理 }) .catch (function(err) { // 失敗処理 });
  10. σʔλετΞ 6OJUZ NCMBObject obj = new NCMBObject("MyClass"); obj.Add("keyname", "value"); obj.SaveAsync

    ((NCMBException e) => { if (e != null) { // 失敗処理 } else { // 成功処理 } });
  11. ϢʔβϩάΠϯ J04 [NCMBUser logInWithUsernameInBackground:@"username" password:@"password" block:^(NCMBUser *user, NSError *error) {

    // 省略 }];
  12. ϢʔβϩάΠϯ "OESPJE NCMBUser.loginInBackground(username, password, new LoginCallback() { @override public void

    done(NCMBUser user, NCMBException e) { // 省略 } });
  13. ϢʔβϩάΠϯ +BWB4DSJQU ncmb.User.login("username", "password") .then(function(result) { // ログイン成功 }) .catch

    (function(err) { // ログイン失敗 });
  14. ϢʔβϩάΠϯ 6OJUZ NCMBUser.LogInAsync("username", "password", (NCMBException e) => { if (e

    != null) { // ログイン失敗 } else { // ログイン成功 } });
  15. "$- J04 NCMBACL *acl = [NCMBACL ACL]; [acl setPublicReadAccess:YES]; NCMBObject

    *obj = [NCMBObject objectWithClassName:@"aclTest"]; [obj setACL:acl]; NSError *e = nil; [obj save:&e];
  16. "$- "OESPJE NCMBAcl acl = new NCMBAcl(); acl.setPublicReadAccess(true); NCMBObject obj

    = new NCMBObject("aclTest"); obj.setAcl(acl);
  17. "$- +BWB4DSJQU var acl = new ncmb.Acl(); acl.setPublicReadAccess(true); var obj

    = ncmb.DataStore("aclTest"); obj.set("acl", acl); obj.save();
  18. "$- 6OJUZ NCMBACL acl = new NCMBACL(); acl.PublicReadAccess = true;

    NCMBObject obj = new NCMBObject("aclTest"); obj.ACL = acl;
  19. ·ͱΊ • ಉҰͷREST APIΛλʔήοτʹ͍ͯ͠ΔͷͰߟ͑ํ ͸ಉ͡ɻ • ίʔϧόοΫख๏ͳͲʹݴޠ͝ͱͷҧ͍ • ϝιου໊͸Ҋ֎౷Ұ͞Ε͍ͯͳ͍