ios - 调用访问提示并将其显示给用户

标签 ios objective-c libgdx

一些背景知识:

我在 Libgdx 中开发了一款游戏并将其上传到 iTunes 应用商店。我的应用程序被拒绝的原因如下:(这不是问题,但我想向您介绍一下我正在努力实现的目标的背景)

> 17.1 Details

Additionally, we noticed that your app does not obtain user consent before collecting the user's personal data.

Specifically, users scores are posted to a high score feature. Please see the attached screenshot(s) for additional information.

Next Steps

To collect personal data with your app, you must make it clear to the user that their personal data will be uploaded to your server and you must obtain the user's consent before the data is uploaded.

- Starting with iOS 6, there are keys for specifying the reason the app will access the user's protected data. When the access prompt is displayed, the purpose specified in these keys is displayed in that dialog box. If your application will be transmitting protected user data, the usage string in your access request should clearly inform the user that their data will be uploaded to your server if they consent.

我的应用程序只将高分上传到我的服务器。但好吧,如果 Apple 声明用户应该知道这一点,我会说清楚。

实际任务:

自从我用 Java 制作这个应用程序以来,我对 Objective-C 编程一无所知。但我知道 iOS 有一些安全对话框,提示用户是否可以在应用程序中使用以下功能或数据。

我想调用这种对话框(用我自己的消息)

enter image description here

我也知道它应该在我的 info.plist 文件中定义,但我不知道如何在运行时访问它并在我的游戏中显示它。

有人知道如何打开它吗?

最佳答案

您可以尝试我的对话框窗口 libgdx 扩展:https://github.com/TomGrill/gdx-dialogs

或:

您需要与平台特定代码进行交互:https://github.com/libgdx/libgdx/wiki/Interfacing-with-platform-specific-code

在您的 iOS 接口(interface)实现中使用 UIAlertView 类打开一个 AlertView:

代码示例:

UIAlertViewDelegateAdapter delegate = new UIAlertViewDelegateAdapter() {

    @Override
    public void didDismiss(UIAlertView alertView, long buttonIndex) {
        //handle button click based on buttonIndex
    }

    @Override
    public void clicked(UIAlertView alertView, long buttonIndex) {

    }

    @Override
    public void cancel(UIAlertView alertView) {

    }

    @Override
    public void willPresent(UIAlertView alertView) {

    }

    @Override
    public void didPresent(UIAlertView alertView) {

    }

    @Override
    public void willDismiss(UIAlertView alertView, long buttonIndex) {

    }

    @Override
    public boolean shouldEnableFirstOtherButton(UIAlertView alertView) {
        return false;
    }

};

String[] otherButtons = new String[1];
otherButtons[0] = "No";
String firstButton = "Yes";


UIAlertView alertView = new UIAlertView("Title", "message", delegate, firstButton, otherButtons);

alertView.show();

关于ios - 调用访问提示并将其显示给用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32398085/

相关文章:

objective-c - 找出 Objective C 中传递给函数的参数是右值 ( @"something") 还是左值 (foo)

android - 更改现有应用程序的证书指纹

android - 致命信号 11 (SIGSEGV),代码 2,tid 19935 (GLThread 3723) 中的故障地址 0x9a44a2e8

ios - Auto Layout 可以用来代替 Asset Catalog 吗?

ios - MKMapView 的黑白叠加层

ios - CCAvenue iOS 套件集成套件

java - 如何在 libgdx 中配置 ArrayList?

ios - 尝试通过构造函数创建对象时,在展开 Optional 值时意外发现 nil

ios:单元 ST AssertEquals -> 类型不匹配

objective-c - 如何使用异步数据加载 NSTableView?