NSItemProvider with an identifier like "com.apple.pkpass"

I am creating an iOS extension and would like to accept Passbook pass. I have a distribution extension working in this:

NSItemProvider *itemProvider = inputItem.attachments.firstObject;
[itemProvider hasItemConformingToTypeIdentifier:@"com.apple.pkpass"];

      

returns true. However, I am getting lost while trying to load this item. I tried to apply it to NSData using this and other types:

[itemProvider loadItemForTypeIdentifier:@"com.apple.pkpass" options:nil completionHandler:^(NSdata *item, NSError *error) {
    NSLog(@"%@", item);
}];

      

However, nothing works. Does anyone know how to use Passbook pass in a share extension? I prefer NSData object.

+3


source to share


1 answer


First enter the return data as "id", then create your PKPass object with "initWithData" with the return data. You don't need to convert it to NSData.



Don't forget to import Passkit.

+4


source







All Articles