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

Intercom.io Custom Attributes for Swift aren't working

我正在尝试在我的 iOS 应用程序中实现 Intercom.io 的自定义属性。我在 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" 无法正常工作。根据 Intercom 的文档,我认为我的语法是正确的: 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)