iOS 在第 3 方应用程序中获取 Safari 保存的信用卡信息

标签 ios iphone safari

我最近一直在研究 safari 保存的密码,我参加了 WWDC session ,其中详细讨论了从 safari 访问保存的凭据和添加保存的凭据。

https://developer.apple.com/videos/play/wwdc2014-506/

http://devstreaming.apple.com/videos/wwdc/2014/506xxeo80e5kykp/506/506_ensuring_continuity_between_your_app_and_web_site.pdf

我还阅读了这篇文章,发现这是从 Safari 中获取已保存凭据的代码,

SecRequestSharedWebCredential(NULL, NULL, ^(CFArrayRef credentials, CFErrorRef error) {

    if (error != NULL) {
        // If an error occurs, handle the error here.
        [self handleError:error];
        return;
    }

    BOOL success = NO;
    CFStringRef server = NULL;
    CFStringRef userName = NULL;
    CFStringRef password = NULL;

    // If credentials are found, use them.
    if (CFArrayGetCount(credentials) > 0) {

        // There will only ever be one credential dictionary
        CFDictionaryRef credentialDict =
        CFArrayGetValueAtIndex(credentials, 0);

        server = CFDictionaryGetValue(credentialDict, kSecAttrServer);
        userName = CFDictionaryGetValue(credentialDict, kSecAttrAccount);
        password = CFDictionaryGetValue(credentialDict, kSecSharedPassword);

    }

});

很明显,我们可以从 safari 访问共享凭据,我看到应用程序可以做这些事情,我也看到了这个 tutorial详细说明了进行集成的步骤。

到目前为止一切都很好,现在我还看到你可以在 safari 中保存信用卡信息,它会自动帮助用户在支付网站上预填信用卡信息。

enter image description here

enter image description here

现在问题来了,第三方应用程序是否可以获取保存在 safari 中的已保存信用卡信息,反之亦然?我做了很多谷歌搜索,它是黑色的,没有关于如何以编程方式进行搜索的完全匹配。可不可以?

最佳答案

假设您的应用程序有配套网站/后端,一种选择是使用 Safari View Controller ( SFSafariViewController ) 在您的网站上启动“添加信用卡”页面 - Safari View Controller 可以访问已保存的信用卡信息(以及其他自动填充信息)。一旦用户输入了他们的新信用卡,您就可以返回到应用的主要流程。

关于iOS 在第 3 方应用程序中获取 Safari 保存的信用卡信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34605526/

相关文章:

iOS - 需要为不同的 iPhone 调整按钮和图像的大小

html - 输入类型范围 webkit-slider-thumb 背景颜色不会在 ios safari 中改变?

ios - 在 iOS 7 中,如何访问 Interface Builder 中的 topLayoutGuide/bottomLayoutGuide?

iOS 检测应用程序已关闭

iphone - UIImage调整大小(缩放比例)

IPHONE:用仪器分析泄漏

ios - 如何从 iOS 上的 native Facebook 应用程序在 Safari 中打开移动网络应用程序链接?

javascript - Windows 8 上的 Safari 5 反转 SVG 上的所有文本元素

ios - Eroor 将 NSPredicate 与 Swift "Could not find an overload for ' init 中的 block 一起使用,它接受提供的参数”

iOS - NSOperation 中的异步 NSURLConnection