OpenFeint 成就百分比增量
我正在制作一个启用 OpenFeint 的 iOS 应用程序。 我已经成功地实现了除一项成就之外的所有成就。这项成就是部分完成的。
我的具体问题是我还没有找到一个可行的解决方案来将 1% 添加到当前的成就百分比。
我找到了这个值(它应该是一个double
):
double achievement12 = [OFAchievementService getPercentComplete:ach12Id
forUser:[OpenFeint lastLoggedInUserID]];
但这会导致以下错误和警告:
“无法在初始化时将 'objc_object*' 转换为 'double'。
“OpenFeint”可能不会响应“+lastLoggedInUserId”
“OFAchievementService”可能不会响应“+getPercentComplete:forUser:”
实际的功能代码是:
// Note: this should be moved into public API
+ (double) getPercentComplete:(NSString*)achievementId forUser:(NSString*)userId
{
sAlreadyAtLeastPartlyCompleteQuery.bind("achievement_definition_id", achievementId);
sAlreadyAtLeastPartlyCompleteQuery.bind("user_id", userId);
sAlreadyAtLeastPartlyCompleteQuery.execute();
float percentComplete = (double) (sAlreadyAtLeastPartlyCompleteQuery.getDouble("percent_complete"));
sAlreadyAtLeastPartlyCompleteQuery.resetQuery();
return percentComplete;
}
这是最后一件事我必须在这个应用程序上做一些事情,它已经困扰我几天了。
I'm making an iOS app which is OpenFeint enabled.
I have managed to get all but one achievement to work. This one achievement is a partially completed one.
My specific problem is that I haven't found a working solution to add 1% to the current achievement percentage.
I found this value (it's supposed to be a double
):
double achievement12 = [OFAchievementService getPercentComplete:ach12Id
forUser:[OpenFeint lastLoggedInUserID]];
but this causes the following errors and warnings:
"Cannot convert 'objc_object*' to 'double' in initialization.
'OpenFeint' may not respond to "+lastLoggedInUserId"
'OFAchievementService' may not respond to "+getPercentComplete:forUser:"
The actual function code is:
// Note: this should be moved into public API
+ (double) getPercentComplete:(NSString*)achievementId forUser:(NSString*)userId
{
sAlreadyAtLeastPartlyCompleteQuery.bind("achievement_definition_id", achievementId);
sAlreadyAtLeastPartlyCompleteQuery.bind("user_id", userId);
sAlreadyAtLeastPartlyCompleteQuery.execute();
float percentComplete = (double) (sAlreadyAtLeastPartlyCompleteQuery.getDouble("percent_complete"));
sAlreadyAtLeastPartlyCompleteQuery.resetQuery();
return percentComplete;
}
This is the last thing I have to do on this app, and it has been bugging me for a few days now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确认
NSSString
成就ID是正确的,我认为它返回一个int
,而不是双精度。使用 OpenFeint 获取当前成就进度
Confirm that the
NSSString
achievement id is correct and I think it returns anint
, not a double.Using OpenFeint to get current Achievement progression
OpenFeint 支持人员表示,由于安全问题,他们尚未集成该部分。
话虽如此,我现在已经诉诸于存储一个包含数据的文件,以便以后可以检索它(当然使用方程式来隐藏真实值)
OpenFeint support said that they have not integrated that part due to security issues.
With that said, i have now resorted to storing a file with the data in so i can retrieve it later (using an equation to hide the real value of course)