0

没有人让 Unity SDK 与自托管 Parse 部署一起工作吗?
如果我使用规定的代码,它看起来像这样:

    ParseClient.Initialize(new ParseClient.Configuration {
        ApplicationId = "abc123",
        Server = "http://exampe.ip.com/parse/"
    });

我得到一个看起来像这样的调用堆栈:

>

 NullReferenceException: Object reference not set to an instance of an object
UnityEngine.WWW.FlattenedHeadersFrom (System.Collections.Generic.Dictionary`2 headers) (at C:/buildslave/unity/build/Runtime/Export/WWW.cs:118)
UnityEngine.WWW..ctor (System.String url, System.Byte[] postData, System.Collections.Generic.Dictionary`2 headers) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UtilsBindings.gen.cs:129)
Parse.Internal.HttpClient.GenerateWWWInstance (System.String uri, System.Byte[] bytes, System.Collections.Hashtable headerTable)
Parse.Internal.HttpClient+<>c__DisplayClass10+<>c__DisplayClass16.<ExecuteAsync>b__9 ()
Parse.PlatformHooks+<RunDispatcher>d__2e.MoveNext ()
UnityEngine.Debug:LogException(Exception)
Parse.<RunDispatcher>d__2e:MoveNext()

我错过了什么?

4

1 回答 1

0

由于windowskey(又名ClientKey)的值为空,我已经对此进行了调试。将您的初始化代码更改为以下内容,它应该可以工作:

ParseClient.Initialize(new ParseClient.Configuration {
    ApplicationId = "abc123",
    Server = "http://exampe.ip.com/parse/",
    WindowsKey = ''   //<== specify an empty string
});

在 index.js 中:

....
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || 'myMasterKey', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',  // Don't forget to change to https if needed
  clientKey: '',   <=== possibly not needed, just to be sure
  liveQuery: {
    classNames: ["Scores", "Posts", "Comments"] // List of classes to support for query subscriptions
  }
});
于 2017-08-14T20:17:55.700 回答