我正在实施我们的平台上的双按钮评级,我正在细细地分析一些细节。理解双按钮评级实施
首先,我真的试着在这里解释一下我所做的简单的麻烦!
我们有三种状态处理,并通过rateItem
和getExtendedMetadata
终端和用户返回可在三种状态之间切换:
0 - 未分级
1 - 最多投票
2 - 下投
所以rateItem
接受这三个选项之一。
看着documentation,我的演示地图应该沿着这些线。
<Match propname="vote" value="0">
<!-- the track is unrated -->
<Ratings>
<Rating AutoSkip="NEVER" Id="1" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess">
...
</Rating>
<Rating AutoSkip="ALWAYS" Id="0" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess">
...
</Rating>
</Ratings>
</Match>
<Match propname="vote" value="1">
<!-- the track is rated thumbs up -->
<Ratings>
<Rating AutoSkip="NEVER" Id="3" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess">
...
</Rating>
<Rating AutoSkip="ALWAYS" Id="2" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess">
...
</Rating>
</Ratings>
</Match>
<Match propname="vote" value="2">
<!-- the track is rated thumbs down -->
<Ratings>
<Rating AutoSkip="NEVER" Id="5" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess">
...
</Rating>
<Rating AutoSkip="ALWAYS" Id="6" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess">
...
</Rating>
</Ratings>
</Match>
这是我开始陷入困境的地方。 <Match ... value="X">
元素看起来很好,并与我的数据显示相匹配。 但单击按钮时,所述rateItem
端点出现通过6.接收的ID 0
的文档状态(ID 4中的例子中丢失):
ID(INT)这是一个该值将传递给rateItem方法。对于给定的属性名称,Id必须是唯一的。
因此,为了解决这个问题,我修改了我的演示文稿映射,以便从0 Match属性发送的ID为1和2(向上和向下投票)。有那么一个链接到0和2 1个匹配属性,以及2链接到0和1。这里就是我在:
<Match propname="vote" value="0">
<!-- the track is unrated -->
<Ratings>
<Rating AutoSkip="NEVER" Id="1" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess">
...
</Rating>
<Rating AutoSkip="NEVER" Id="2" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess">
...
</Rating>
</Ratings>
</Match>
<Match propname="vote" value="1">
<!-- the track is rated thumbs up -->
<Ratings>
<Rating AutoSkip="NEVER" Id="0" StringId="VoteUpCancel" OnSuccessStringId="VoteUpCancelSuccess">
...
</Rating>
<Rating AutoSkip="NEVER" Id="2" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess">
...
</Rating>
</Ratings>
</Match>
<Match propname="vote" value="2">
<!-- the track is rated thumbs down -->
<Ratings>
<Rating AutoSkip="NEVER" Id="1" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess">
...
</Rating>
<Rating AutoSkip="NEVER" Id="0" StringId="VoteDownCancel" OnSuccessStringId="VoteDownCancelSuccess">
...
</Rating>
</Ratings>
</Match>
注字符串ID也更新了,我相信我的字符串文件和图像都很好。
这对我来说很有意义,但实际上是抛出我的图像和警报,并且我在不同的平台上有不同的结果(迄今在iOS和Mac控制器上测试过)。
在这一点上,任何人都可以提供任何建议吗?我希望我在这里有足够的感觉!我非常感谢任何人可以提供的提示。