Intercom.io Swift 的自定义属性不起作用



我正在尝试实现对讲机的自定义属性。我在XCode 7, Swift 2和iOS 9。

下面是我的代码:

class func updateUser(user: User) {
    Intercom.updateUserWithAttributes([
        "name": user.name,
        "email": user.email
    ])
    let userAttributes = ([
        "role": "customer",
        "phone": user.phone,
        "First Name": user.firstName,
        "Last Name": user.lastName,
        "Referral Code": user.referralCode,
        "Avatar Pic": user.avatarURL,
        "Profile Pic": user.profilePicURL
    ])
    Intercom.updateUserWithAttributes(["custom_attributes": userAttributes])
}

我成功提交"name" &"email",但我的"custom_attributes"不起作用。我认为我的语法是正确的,根据对讲机的文档:https://docs.intercom.io/Install-on-your-mobile-product/configuring-intercom-for-ios

但是我是一个Swift新手,没有使用Obj-C的经验。

同样重要的是要注意,我的事件通过。

Intercom.logEventWithName(eventName)

我的语法有什么问题吗??还有别的吗?请帮助!

结果有两个问题:

1)对讲机文档错误,自定义属性不需要"custom_attributes"标签

2)我的URL格式是NSURL而不是字符串,因此整个对象被拒绝

固定了!感谢Intercom的Dale的支持

代码很简单:

let userAttributes = [
        "name": user.name,
        "email": user.email,
        "role": "customer",
        "phone": user.phone,
        "first_name": user.firstName,
        "last_name": user.lastName,
        "referral_code": user.referralCode,
        "avatar_pic": user.avatarURLString,
        "profile_pic": user.profilePicURLString
    ]
Intercom.updateUserWithAttributes(userAttributes)

最新更新