How can I add values to the pass using Passslot?

匆匆过客 提交于 2019-12-24 07:32:42

问题


I'm integrating Passlot in my app for wallet integration. I'd created new pass type id and added it in Passslot.

I'd created a pass template for type - boarding pass as below,

And in my app, i'm creating the pass with the above template and a dictionary with values,

NSDictionary *values = [NSDictionary dictionaryWithObjectsAndKeys:
                        @"14", @"gate" ,
                        @"India", @"depart" ,
                        @"UAE", @"arrive" ,
                        @"2:25 PM", @"boardingTime",
                        @"Air India", @"flightNewName" ,
                        @"first", @"class",
                        @"7/22", @"date" ,
                        @"name", @"passenger",nil];

[PassSlot createPassFromTemplateWithName:@"Sample" withValues:values andRequestInstallation:self completion:^{
    NSLog(@"Created");
}];

The pass is created, but the values that I'm passing are not there in the pass. It's showing the default values in the pass template.

I'm passing the values in the dictionary input. why it's not coming?

How can I solve it? Please guide me on this.


回答1:


In order for PassSlot to be able to show your provided data, you need to tell the system where it should appear on the pass.

For this we have our so called placeholder system. It allows you to define any number of data fields, called placeholders, that can be provided during creation of the pass.

The easiest way to create placeholders on the fly and tell the system where to show the data is by writing ${<name of placeholder>} on your template. This will automatically create a text placeholder for you.

So in order for your provided gate 14 from to data to appear on the top right of the pass, replace on the template the 23 with ${gate}. The same you can do with all other provided data as well.

Placeholders are pretty flexible, you can use them anywhere (barcode, backside & non-visible parts) and you can also have multiple placeholders per field (e.g. you could have PASSENGER composed of ${firstName} ${lastName}). Placeholders can also have different types then text for advanced use cases, you can see and edit them in the placeholders tab when you edit the template.



来源:https://stackoverflow.com/questions/37025264/how-can-i-add-values-to-the-pass-using-passslot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!