【问题标题】:Passing an object to a Meteor method using swiftDDP使用 swiftDDP 将对象传递给 Meteor 方法
【发布时间】:2016-10-27 17:09:14
【问题描述】:

我正在尝试将流星和 iOS 用于我的一个项目。我的问题是我正在尝试使用 swiftDDP 库连接到流星函数。发送数据时,它以错误的格式发送。如何从 iOS 传递 Meteor(在 js 中运行)将接受的对象?有没有办法使用字符串来做到这一点?我有调用相同函数的工作 javascript 代码我将如何从 iOS/swift 传递相同形式的数据?

Javascript

Meteor.call('xxx', {a: 1, b: 2, c: "some text"});

IOS(传递任何对象)

Meteor.call("xxx", ?? )

【问题讨论】:

  • 解决了这个问题我在 IOS swift let data 上以这种格式创建了一个对象: [String : AnyObject] = [ "time" : {time object} "foo" : "1", "blah" : "1", ] 然后简单地调用 Meteor.call("events.add", params: [data]) { result, error in // 用方法 result NSLog("call working") }

标签: ios swift meteor


【解决方案1】:

解决了这个问题我在 IOS swift let data 上以这种格式创建了一个对象:[String : AnyObject] = [ "time" : {time object} "foo" : "1", "blah" : "1", ]然后简单地调用 Meteor.call("events.add", params: [data]) { result, error in // Do something with the method result NSLog("call working") }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 2011-09-27
    • 2014-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多