SDK

Implementation

By default, when you use push notifications to send your passes, our library will only handle web passes. However you can always use PassKit native controllers to present your native Wallet passes.

For this you need to change our Flutter plugin and include the following in the NotificarePushLibPlugin.m file:

#import <PassKit/PassKit.h>
...more code
@interface NotificarePushLibPlugin () <FlutterStreamHandler,NotificarePushLibDelegate,PKAddPassesViewControllerDelegate>

Then, uncomment the following method:

- (void)notificarePushLib:(NotificarePushLib *)library didReceivePass:(NSURL *)pass inNotification:(NotificareNotification*)notification{

    NSData *data = [[NSData alloc] initWithContentsOfURL:pass];
    NSError *error;

    PKPass * pkPass = [[PKPass alloc] initWithData:data error:&error];

    if(!error){
        PKAddPassesViewController * vc = [[PKAddPassesViewController alloc] initWithPass:pkPass];
        [vc setDelegate:self];
        [[NotificarePushLib shared] presentWalletPass:notification inNavigationController:[[NotificareReactNativeIOS getInstance] navigationControllerForRootViewController] withController:vc];

    }

}

After these changes, all passes you send in a push message will be handled as a native Wallet pass.

You can also request passes by their serial and retrieve the raw pass object:

try {
  NotificarePass response = await notificare.fetchPassWithSerial(serial);
  //Handle Success
} catch(e){
  //Handle Error
}

If instead you wish to retrieve a pass using its custom barcode, you should use the following method:

try {
  NotificarePass response = await notificare.fetchPassWithBarcode(barcode);
  //Handle Success
} catch(e){
  //Handle Error
}