如何在 self.Self 对象中填充 addressInfos 对象
How To Fill addressInfos object in self.Self object
我正在尝试从用户的个人资料中获取用户设置的家庭住址。在设备上进行测试时,在配置文件中设置时,我一直看到它是空的。
这是用于提取信息的操作:
action (ReturnSelfAddress) {
type (Constructor)
description (Gets address from profile)
collect {
input (mySelf) {
min (Required)
type (self.Self)
}
}
output (geo.SearchTerm)
}
这与从 self.addressInfos
字段中提取 home
地址的 javascript 文件一起使用。
这是我在设备上的个人资料的屏幕截图:
还有一个地址。
在测试中我使用的是真实地址。
我从个人资料中得到的结果自我对象是:
{
addressInfos = [],
birthdayInfo = {
calculatedFromNow = null,
day = 1,
fuzzyFactor = null,
holiday = null,
month = 1,
namedDate = null,
parseTree = null,
year = 1911,
$id = null,
$type = viv.contact.BirthdayInfo
},
contactId = null,
emailInfos = [{
address = fake@fake.com,
emailType = Home,
$id = null,
$type = viv.contact.EmailInfo
}],
isFavorite = null,
nameInfo = {
firstName = Bill,
initial = null,
lastName = Faker,
middleName = null,
nickName = ,
prefix = null,
structuredName = Bill Faker,
suffix = null,
$id = null,
$type = viv.contact.NameInfo
},
phoneInfos = [],
photoInfo = {
caption = null,
dimensions = null,
rotation = null,
size = null,
subtitle = null,
title = null,
url = http://image.to.be.put/here,
$id=null, $type=viv.contact.PhotoInfo
},
relationshipInfos=[],
workInfo=null,
$id=null,
$type=viv.self.Self
}
如您所见,addressInfos
数组为空。我应该如何访问用户的个人资料地址?
编辑:
这里的个人信息是我编造的虚拟数据,所以我不必分享我的真实电子邮件、生日、phone 号码等......在我的设备上实际测试时,所有这些信息都与我的真实开发者相匹配帐号。
请double-check您在三星帐户中填写了一个地址:
https://www.samsung.com/us/support/account/info/
viv.self.Self 已链接到三星帐户。
在设备上,设置 -> 右上角,您将能够编辑您的三星帐户。
我刚刚添加了一个工作地址,并且能够使用以下 JS 代码访问它。
module.exports.function = function displayProfile (self) {
console.log(self)
if (self)
return 'lable = ' + self.addressInfos[0].label + ' address = ' + self.addressInfos[0].address.unstructuredAddress;
else
return 'Not self';
}
当前 IDE 能够从您的三星帐户中获取这些信息,因此您无需 on-device 测试即可进行测试。当然,私下提交后,我也在设备上进行了测试,是可以正常使用的。
我正在尝试从用户的个人资料中获取用户设置的家庭住址。在设备上进行测试时,在配置文件中设置时,我一直看到它是空的。
这是用于提取信息的操作:
action (ReturnSelfAddress) {
type (Constructor)
description (Gets address from profile)
collect {
input (mySelf) {
min (Required)
type (self.Self)
}
}
output (geo.SearchTerm)
}
这与从 self.addressInfos
字段中提取 home
地址的 javascript 文件一起使用。
这是我在设备上的个人资料的屏幕截图:
还有一个地址。
在测试中我使用的是真实地址。
我从个人资料中得到的结果自我对象是:
{
addressInfos = [],
birthdayInfo = {
calculatedFromNow = null,
day = 1,
fuzzyFactor = null,
holiday = null,
month = 1,
namedDate = null,
parseTree = null,
year = 1911,
$id = null,
$type = viv.contact.BirthdayInfo
},
contactId = null,
emailInfos = [{
address = fake@fake.com,
emailType = Home,
$id = null,
$type = viv.contact.EmailInfo
}],
isFavorite = null,
nameInfo = {
firstName = Bill,
initial = null,
lastName = Faker,
middleName = null,
nickName = ,
prefix = null,
structuredName = Bill Faker,
suffix = null,
$id = null,
$type = viv.contact.NameInfo
},
phoneInfos = [],
photoInfo = {
caption = null,
dimensions = null,
rotation = null,
size = null,
subtitle = null,
title = null,
url = http://image.to.be.put/here,
$id=null, $type=viv.contact.PhotoInfo
},
relationshipInfos=[],
workInfo=null,
$id=null,
$type=viv.self.Self
}
如您所见,addressInfos
数组为空。我应该如何访问用户的个人资料地址?
编辑: 这里的个人信息是我编造的虚拟数据,所以我不必分享我的真实电子邮件、生日、phone 号码等......在我的设备上实际测试时,所有这些信息都与我的真实开发者相匹配帐号。
请double-check您在三星帐户中填写了一个地址: https://www.samsung.com/us/support/account/info/
viv.self.Self 已链接到三星帐户。
在设备上,设置 -> 右上角,您将能够编辑您的三星帐户。 我刚刚添加了一个工作地址,并且能够使用以下 JS 代码访问它。
module.exports.function = function displayProfile (self) {
console.log(self)
if (self)
return 'lable = ' + self.addressInfos[0].label + ' address = ' + self.addressInfos[0].address.unstructuredAddress;
else
return 'Not self';
}
当前 IDE 能够从您的三星帐户中获取这些信息,因此您无需 on-device 测试即可进行测试。当然,私下提交后,我也在设备上进行了测试,是可以正常使用的。