首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Swift的Intercom.io自定义属性不起作用

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

Stack Overflow用户
提问于 2015-10-17 13:39:57
回答 1查看 1.3K关注 0票数 0

我正试图在我的Intercom.io应用程序中实现iOS的自定义属性。我在XCode 7,Swift 2和iOS 9。

这是我的密码:

代码语言:javascript
复制
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])
}

我成功地提交了“姓名”和“电子邮件”,但我的"custom_attributes“不起作用。根据对讲机的文档:https://docs.intercom.io/Install-on-your-mobile-product/configuring-intercom-for-ios,我认为我的语法是正确的

但我是个斯威夫特新手,对奥比杰-C没有经验。

同样重要的是要注意,我的事件是通过适当的报告。

代码语言:javascript
复制
Intercom.logEventWithName(eventName)

我的语法有什么问题吗??或者别的什么?请帮帮我!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-19 13:47:29

结果发现有两个问题:

1)内部通信文档错误和自定义属性不需要"custom_attributes“标记

2)我的URL格式是NSURL而不是String,因此整个对象都被拒绝了

现在就修好!感谢对讲机对Dale的支持

守则很简单:

代码语言:javascript
复制
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)
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33187287

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档