【问题标题】:Passbook file opens on Safari OSX, but not Safari iOSPassbook 文件在 Safari OSX 上打开,但不是 Safari iOS
【发布时间】:2015-09-16 23:11:46
【问题描述】:

我正在尝试将 Passbooks 添加到我的应用程序中。我一直在摆弄它,但仍然没有运气!

适用于 OSX 浏览器

当我在本地 (OSX) 工作时,我在 Chrome 和 Safari 中下载存折,它们打开得很好:

在 iOS 浏览器上静默失败

但是,如果我使用 iOS 模拟器 + Mobile Safari,我会看到一条错误消息并且没有日志消息 ????:

如果我使用 iPad(iOS 8 和 9),我会得到相同的行为:错误消息 + 日志中没有任何内容。

一件疯狂的事情:我们确实有一个在运行 iOS 9 的 iPhone 上成功打开,但仅此而已。之前在 iOS 8 上使用 iPhone 的尝试没有成功。

适用于 iMessage => iOS

我的同事从这个问题下载了文件,通过 iMessage 将其发送到他的设备并成功安装。到底是什么!!

示例文件

这是一个示例 .pkpass 文件:http://rmosolgo.github.io/assets/rm_example.pkpass

我尝试过的

内容类型标头

我已确定我使用了正确的内容类型。这是 Rails 代码:

  format.pkpass {
    # This is just for testing: visit .pkpass to download a pass file just like the
    # one that would be attached to the email
    pkpass = pass.to_pkpass
    send_data(pkpass.stream.string, 
      filename: pass.to_pkpass_filename, 
      content_type: "application/vnd.apple.pkpass"
    ) 
  }

它似乎在 GET 请求中遇到:

有效的 JSON

我尝试解压缩.pkpass 并检查pass.json。一切都好!

现在怎么办??

我已经看到很多关于此的 SO 问题,但它们都涉及某种日志输出。我没有得到任何日志输出!我能做些什么?你有什么建议吗??

非常感谢!

【问题讨论】:

    标签: ios macos mobile-safari passbook passkit


    【解决方案1】:

    首先,您托管文件的 github 服务器未发送正确的 Content-Type 标头:

    $ curl -I http://rmosolgo.github.io/assets/rm_example.pkpass
    
    HTTP/1.1 200 OK
    Server: GitHub.com
    Content-Type: application/octet-stream
    Last-Modified: Wed, 16 Sep 2015 23:00:53 GMT
    Access-Control-Allow-Origin: *
    Expires: Thu, 17 Sep 2015 01:41:38 GMT
    Cache-Control: max-age=600
    Content-Length: 748362
    Accept-Ranges: bytes
    Date: Thu, 17 Sep 2015 01:31:38 GMT
    Age: 0
    X-Served-By: cache-iad2133-IAD
    X-Cache: MISS
    X-Cache-Hits: 0
    X-Timer: S1442453498.285053,VS0,VE7
    Vary: Accept-Encoding
    X-Cache: MISS from liveandlearnatlanta.hotelwifi.com
    Via: 1.1 varnish, 1.1 liveandlearnatlanta.hotelwifi.com (squid/3.3.2)
    Connection: keep-alive
    

    当提供正确的标头时,传递正确加载和摄取。

    但是,日志表明您的注册 Web 服务设置不正确,并发出 404 响应而不是预期的 201

    Sep 16 21:35:35 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:35 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:42 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:42 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Generating POST request with URL <https://check-ins-staging.planningcenteronline.com/v1/devices/b0d117f8963f3d5103637f4ca990e69a/registrations/pass.com.PlanningCenter.CheckIn/89709>
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Request contains header field <Authorization: ApplePass 2ece029fc4b7abe8aedfe95fe2375815e2504cc58ad3111689e29f08f8dbb689>
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Request contains body dictionary {
            pushToken = 5d1844d7403dfeca24f8a2275c3161a801515f94c1e07909de5ea6aa85f08479;
        }
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:43 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Verifying structure and signature for pass pass.com.PlanningCenter.CheckIn/89709
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Signature validation: succeeded
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) got response with code 404
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) encountered error: Unexpected response code 404
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Generating POST request with URL <https://check-ins-staging.planningcenteronline.com/v1/log>
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Request contains body dictionary {
            logs =     (
                "[2015-09-16 21:35:44 -0400] Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) encountered error: Unexpected response code 404"
            );
        }
    Sep 16 21:35:44 iPhone passd[140] <Warning>: Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) will retry after 10 seconds
    Sep 16 21:35:45 iPhone passd[140] <Warning>: Log task (pass type pass.com.PlanningCenter.CheckIn, web service url https://check-ins-staging.planningcenteronline.com) got response with code 200
    Sep 16 21:35:54 iPhone passd[140] <Warning>: Generating POST request with URL <https://check-ins-staging.planningcenteronline.com/v1/devices/b0d117f8963f3d5103637f4ca990e69a/registrations/pass.com.PlanningCenter.CheckIn/89709>
    Sep 16 21:35:54 iPhone passd[140] <Warning>: Request contains header field <Authorization: ApplePass 2ece029fc4b7abe8aedfe95fe2375815e2504cc58ad3111689e29f08f8dbb689>
    Sep 16 21:35:54 iPhone passd[140] <Warning>: Request contains body dictionary {
            pushToken = 5d1844d7403dfeca24f8a2275c3161a801515f94c1e07909de5ea6aa85f08479;
        }
    Sep 16 21:35:55 iPhone passd[140] <Warning>: Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) got response with code 404
    Sep 16 21:35:55 iPhone passd[140] <Warning>: Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) encountered error: Unexpected response code 404
    Sep 16 21:35:55 iPhone passd[140] <Warning>: Generating POST request with URL <https://check-ins-staging.planningcenteronline.com/v1/log>
    Sep 16 21:35:55 iPhone passd[140] <Warning>: Request contains body dictionary {
            logs =     (
                "[2015-09-16 21:35:55 -0400] Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) encountered error: Unexpected response code 404"
            );
        }
    Sep 16 21:35:55 iPhone passd[140] <Warning>: Register task (for device b0d117f8963f3d5103637f4ca990e69a, pass type pass.com.PlanningCenter.CheckIn, serial number 89709; with web service url https://check-ins-staging.planningcenteronline.com) will retry after 10 seconds
    

    【讨论】:

    • 感谢您的测试!我看到你已经回答了存折的其他问题,我希望你能找到这个!我看到你的日志来自 iPhone 并且......果然:适用于 iPhone,而不是 iPad。我猜 iPad 不支持存折!
    • 正确,iPad 不支持 Passbook。
    【解决方案2】:

    不要在 iPad 上测试存折——它似乎不起作用。对我来说,如果我使用 iPhone,则可以使用真正的 iPhone,而 iOS 模拟器也可以使用!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-20
      • 1970-01-01
      • 2012-12-02
      • 1970-01-01
      • 2016-01-05
      • 1970-01-01
      相关资源
      最近更新 更多