How do I serve an iOS app .plist file using Rails? - Stack Overflow

I'm attempting to setup a Rails 7 application to serve an enterprise iOS app. This requires sendin

I'm attempting to setup a Rails 7 application to serve an enterprise iOS app. This requires sending a .plist file to the iOS device. The plist file specifies, among other things, the URL of the actual download of the .ipa file, which is the app installer itself.

Serving the .ipa file is not an issue. But I'm running into trouble with the plist. I'd like to be able to use a template with ERB and serve it as needed, yet I haven't been able to get that to work. When I do that, the iPhone browser asks if I'd like to save the plist file, like you'd see with a standard download. But if it's working correctly, the phone should ask if I'd like to install the app.

I can make everything work if I upload a working plist file to Active Storage and send it to the client with the following in the controller:

binary = u/program.plist.download
u/program.plist.open do |plist|
  send_data binary
end

But this isn't really what I want. I'd much rather use a template that creates a plist on the fly, as mentioned above.

I have:

  • Added plist as a MIME type in config/initializers/mime_types.rb with Mime::Type.register "application/x-plist", :plist
  • Tried serving the generated plist with both send_data and send_file, and verified that the file being served is interpolating the ruby code properly.

But it always presents the plist as a download.

The iOS device expects an initial response like the following:

def show
  redirect_to "itms-services://?action=download-manifest&url=#{path/to/plist}"
end

So the device is expecting to be redirected to a URL which will serve the plist file.

Any suggestions on how to do this? Or what I might be missing?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744828746a4595954.html

相关推荐

  • How do I serve an iOS app .plist file using Rails? - Stack Overflow

    I'm attempting to setup a Rails 7 application to serve an enterprise iOS app. This requires sendin

    2天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信