Code Monkey home page Code Monkey logo

Comments (11)

krishnakumar-k avatar krishnakumar-k commented on August 11, 2024

I am also facing the same issue.

  public static async Task Main()
        {
            var options = new PassKitOptions()
            {
                // See `how_to_create_pfx.md` to create your onw pfx file  
                PassCertificate = new X509Certificate2(File.ReadAllBytes("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\pass.pfx"),"password"),
                
                AppleCertificate = new X509Certificate2(File.ReadAllBytes("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\AppleWWDRCAG3.cer")),
                ConfigureNewPass =
                    p =>
                        p.Standard
                            .PassTypeIdentifier("pass.com.apple.devpubs.example")
                            .SerialNumber("PassKitHelper")
                            .TeamIdentifier("A93A5CM278")
                            .OrganizationName("PassKit")
                        .VisualAppearance
                            .LogoText("COVID-19 Vaccination Record Card")
                        .Generic
                            .AuxiliaryFields
                                .Add("github")
                                    .Label("GitHub link")
                                    .Value("https://github.com/justdmitry/PassKitHelper"),
            };

           // var passKitHelper = new PassKitHelper(options);
            IPassKitHelper passKitHelper = new PassKitHelper(options);
            await GenerateSamplePass(passKitHelper);

            //// uncomment to send push notification
            //// attention! your pass (you push update for) must already include WebService fields (auth.token and endpoint), and your web service/app must be up and running
            //// var registrationPushToken = "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
            //// var ok = await passKitHelper.SendPushNotificationAsync(registrationPushToken);
        }

        public static async Task GenerateSamplePass(IPassKitHelper passKitHelper)
        {
            var pass = passKitHelper.CreateNewPass()
                .Standard
                    .Description("PassKitHelper demo pass")
                ////.WebService
                ////    .AuthenticationToken("some-nonce")
                ////    .WebServiceURL("https://www.example.com/")
                .VisualAppearance
                    .Barcodes("1234567890128", BarcodeFormat.QR)
                    .ForegroundColor("rgb(44, 62, 80)")
                    .BackgroundColor("rgb(149, 165, 166)")
                    .LabelColor("rgb(236, 240, 241)")
                .Generic
                    .PrimaryFields
                        .Add("version")
                            .Label("Library version")
                            .Value(typeof(IPassKitHelper).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion)
                ;

            var package = await passKitHelper.CreateNewPassPackage(pass)
                .Icon(await File.ReadAllBytesAsync("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\icon.png"))
                .Icon2X(await File.ReadAllBytesAsync("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\[email protected]"))
                .Logo(await File.ReadAllBytesAsync("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\logo.jpg"))
                //.Strip(await File.ReadAllBytesAsync("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\strip.jpg"))
                //.Strip2X(await File.ReadAllBytesAsync("C:\\Users\\krishnakumar.k\\Downloads\\PassKitHelper-master\\PassKitHelper-master\\PassKitHelper.Demo\\images\\[email protected]"))
                .SignAndBuildAsync();

            await File.WriteAllBytesAsync("Sample.pkpass", package.ToArray());
        }

from passkithelper.

justdmitry avatar justdmitry commented on August 11, 2024

Some images are required. Try uncomment (return) Strip2x image back.

from passkithelper.

krishnakumar-k avatar krishnakumar-k commented on August 11, 2024

Now the file generated in windows. Can I share the file through the mail and verify it in IOS?

from passkithelper.

justdmitry avatar justdmitry commented on August 11, 2024

Double-check that you put correct PassTypeIdentifier and TeamIdentifier and they matches your certificate. My demo works correct only after replacing this values to your own (it generates passes anyway, but pass opens on my iPhone only when correct values are provided).

from passkithelper.

krishnakumar-k avatar krishnakumar-k commented on August 11, 2024

Hi Dmitry ,

After generating a new pfx file, We can able to generate and preview the file in MAC, But I downloaded the same file in mobile and try to open it, I couldn't Add it.
Screenshot 2021-01-13 at 5 31 13 PM (1)

Thanks

from passkithelper.

aravindhjahan25 avatar aravindhjahan25 commented on August 11, 2024

am also facing the same issue. I successfully generated the .pkpass file and able to see the preview in mac laptop. I shared it via email to my iPhone the pkpass file not added to my apple wallet.

from passkithelper.

justdmitry avatar justdmitry commented on August 11, 2024

When I make invalid passes - iPhone does not display them at all. So, if you can view pass on iPhone but can't add it to Wallet - it's something other, not file. Can you share generated file somehow?

from passkithelper.

krishnakumar-k avatar krishnakumar-k commented on August 11, 2024

I have attached the sample file here in zip format. Because .pkpass format not supported to attach. Please change the file format and verify.

Sample.zip

Thanks

from passkithelper.

justdmitry avatar justdmitry commented on August 11, 2024

It's not opening on my phone. Double-check that you used correct PassTypeIdentifier and TeamIdentifier, and correct PFX, and so on. I never tried to build passes on Mac, so if you have some kind of VM with Windows - try build inside it.

from passkithelper.

krishnakumar-k avatar krishnakumar-k commented on August 11, 2024

Hi,

Now it's working after used the new AppleWWDRCA.cer file "2023". But the bar code does not generate like yours, Instead of added multiple lines. We are using "BarcodeFormat.Code128" format only.
image

How to change the font size. Because Secondary and Auxiliary fields are showing different sizes and styles.

Thanks

from passkithelper.

justdmitry avatar justdmitry commented on August 11, 2024

Oh, old/expired certificate can cause issues with signing and validating, good point.

Barcode - unzip pass and check pass.json - may be you put some "strange" (non-latin) characters into "message" ?

Font size - you can't change it. Apple asks only color, but layout management is done by your phone itself. Change texts (length) until you satisfied how it rendered.

from passkithelper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.