如何在我的应用程序中访问存折的通行证? [英] How to access passes from passbook in my app?

查看:297
本文介绍了如何在我的应用程序中访问存折的通行证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建应用,我正在添加并显示从iOS6的存折应用到我的应用的传递。但是当我在模拟器上运行应用程序时,它显示了添加的通行证,但是当我在设备上运行相同时,它显示我的存折是空的。

I'm creating app in which I'm adding and showing passes from passbook app of iOS6 to my app. But when I run application on simulator it's showing added passes but when I run same on Device it's showing that my passbook is empty.

我已经跟着 iOS6教程集成存折你的应用程序链接,用于创建,添加和显示通行证。

I have followed iOS6 tutorial integrating passbook your applications link for creating, adding and showing passes.

用于访问我使用过以下代码的传递 -

for accessing passes I have used following code -

NSArray * passArray = [_passLib passes];
NSLog(@"number of passes in library are: %d",[passArray count]);

//if more tha one pass in library, just use the first one.
if ([passArray count] > 0)
{

    for (int i = 0; i<[passArray count]; i++) 
    {    
    PKPass *onePass = [passArray objectAtIndex:i]; 

    //access general fieldnames
    NSLog(@"%@",[onePass localizedName]);
    NSLog(@"%@",[onePass organizationName]);

    //access a specific field name
    NSLog(@"%@",[onePass localizedValueForFieldKey:@"rewards"]);    
    }
}

如果我们运行app,是否需要进行任何更改在设备上支持存折集?

Do we need to make any changes if we run app on device to support passbook integration?

推荐答案

创建类似于passTypeIdentifier的AppId。例如,如果您的passTypeIdentifier是pass.abc.xyz,那么您的AppId必须是com.abc.xyz。创建配置文件时,请使用此appId并为您的应用程序使用此配置文件。然后,只有您能够区分存折中的可用通行证。

Create AppId which is similar to passTypeIdentifier. For example if your passTypeIdentifier is pass.abc.xyz then your AppId must be com.abc.xyz .While creating provisioning profile make use of this appId and make use of this provisioning profile for your app. Then only you will be able to distinguish passes available in your passbook.

这篇关于如何在我的应用程序中访问存折的通行证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆