tomasmcguinness / dotnet-passbook

A .Net Library for generating Apple Passbook (Wallet) files for iOS. Please get involved by creating pull requests and opening issues!
MIT License
319 stars 117 forks source link

Unable to add background image #201

Closed saudyahya closed 5 days ago

saudyahya commented 6 days ago

Background isn't being added using below code. None of the dimensions worked.

private void AddImages(PassGeneratorRequest request) { try { request.Images.Add(PassbookImage.Background, System.IO.File.ReadAllBytes("Images/CardTemp.png")); } catch (Exception ex) { _logger.LogError(ex, "Failed to add images."); throw new InvalidOperationException("Failed to add images to the pass.", ex); } }

saudyahya commented 5 days ago

Just figured out that to add a background image we should use the attribute Style = PassStyle.EventTicket. According to Apple Wallet documentation, not all passes support background images. https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/PassKit_PG/Creating.html#//apple_ref/doc/uid/TP40012195-CH4-SW1