2016-01-05 24 views
2

我一直在最近围绕Safari浏览器保存密码,并且通过WWDC会话详细讨论了从safari访问已保存的凭据并添加已保存的凭据。iOS在第三方应用程序中抓取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浏览器,反之亦然保存的信用卡信息?我做了这么多谷歌搜索,这是点黑色,没有完全匹配如何以编程方式。有没有可能?

+0

面临同样的问题。 http://9to5mac.com/2014/10/11/ios-8-how-to-use-camera-to-enter-in-credit-card-info/我想在我的应用程序中实现这样的东西。 – Abhi

+0

@Ahi很抱歉,即使在iOS 10中也没有这样的apis。 – satheeshwaran

回答

1

假设您的应用程序有一个伴侣网站/后端,一个选项是使用Safari浏览器视图控制器(SFSafariViewController)在您的网站上启动“添加信用卡” - Safari视图控制器可以访问保存的信用卡信息以及其他自动填充信息)。一个用户输入了他们的新信用卡,您可以返回到您的应用的主要流程。

相关问题