ios wallet开发_iOS 添加票据到wallet
-(void)addPassbookView:(NSData *)date{NSError *error = nil;BOOL passEnbale = [PKPassLibrary isPassLibraryAvailable];//检查pass是否可用if (![PKPassLibrary isPassLibraryAvailable]) {//dispatch_async(dispatch_
-(void)addPassbookView:(NSData *)date{
NSError *error = nil;
BOOL passEnbale = [PKPassLibrary isPassLibraryAvailable];//检查pass是否可用
if (![PKPassLibrary isPassLibraryAvailable]) {//
dispatch_async(dispatch_get_main_queue(), ^{
//[[WaitDialogFullS sharedWaitDialog] endLoading];
[[[UIAlertView alloc] initWithTitle:@"Error"
message:@"PassKit not available"
delegate:nil
cancelButtonTitle:GDLocalizedString(@"jpyd_ok")
otherButtonTitles: nil] show];
});
return;
}
if (passEnbale) {
PKPass *onePass = [[PKPass alloc] initWithData:date error:&error];
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
// [[WaitDialogFullS sharedWaitDialog] endLoading];
ZNLog(@"!!!!!ERROR:%@",[error description]);
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:GDLocalizedString(@"jpyd_Friendlyreminder") message:GDLocalizedString(@"sy_onePass") delegate:nil cancelButtonTitle:GDLocalizedString(@"jpyd_ok") otherButtonTitles:nil, nil];
[alert show];
[alert release];
});
return ;
}
dispatch_async(dispatch_get_main_queue(), ^{
PKAddPassesViewController *passAddViewController = [[[PKAddPassesViewController alloc] initWithPass:onePass]autorelease];
passAddViewController.delegate = self;
ChinaEastViewController *app = [ChinaEastViewController sharedBankcommViewController];
//Application tried to present a nil modal view controller on target .修改听云,李良
if (passAddViewController) {
[app presentViewController:passAddViewController animated:YES completion:^{
// [[WaitDialogFullS sharedWaitDialog] endLoading];
}];
}
});
}
}
更多推荐
所有评论(0)