如何在 iOS 中的 info.plist 中添加属性

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20114801/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:28:13  来源:igfitidea点击:

How to add properties in info.plist in iOS

iosiphoneobjective-cipadinfo.plist

提问by bapi

I want to open PDF attachment via email in my own application: I refer two link here:

我想在我自己的应用程序中通过电子邮件打开 PDF 附件:我在这里参考了两个链接:

How do I associate file types with an iPhone application?

如何将文件类型与 iPhone 应用程序相关联?

and here on Raywenderlich

这里Raywenderlich

where it shows some XML content, and says its added to info.plist.My info.plist is shown like this attachment. How can I add content to info.plist to make it visible as XML document.! My info.plist

它显示了一些 XML 内容,并说它添加到 info.plist.My info.plist 显示为这个附件。如何将内容添加到 info.plist 以使其作为 XML 文档可见。!我的信息.plist

回答by Matěj Mefj? Novák

plist files is nothing more than XML document that Xcode view in his own way. You can Right click -> Open as -> Source Codeto get view you want.

plist 文件只不过是 Xcode 以他自己的方式查看的 XML 文档。您可以右键单击 -> 打开为 -> 源代码以获取所需的视图。

Also you can add to plist directly by clicking plus sign or Right click -> Add Row. Default view of plist can give you a suggestions, so I recommend you to use this instead of viewing as XML

您也可以通过单击加号或右键单击 -> 添加行来直接添加到 plist。plist 的默认视图可以给你一个建议,所以我建议你使用它而不是查看为 XML

回答by lxzhh

info.plist is a system level plist in iPhone application, you can add properties by adding a property like this:enter image description here

info.plist 是 iPhone 应用程序中的系统级 plist,您可以通过添加这样的属性来添加属性:在此处输入图片说明

回答by mprivat

Right click on the .plist in Xcode and select "Open As -> Source code"

右键单击 Xcode 中的 .plist 并选择“Open As -> Source code”

回答by Naishta

may be worth mentioning how to get there..

可能值得一提的是如何到达那里..

Info.plist is one of the file below the Main.storyboard or viewController.swift

Info.plist 是 Main.storyboard 或 viewController.swift 下面的文件之一

when you click on it first time it usually is in a table format,so right click the file and 'open as' Source code and then add the code

当您第一次单击它时,它通常是表格格式,因此请右键单击该文件并“打开为”源代码,然后添加代码

回答by Bourne

If you want to view it as XML, just find the plist file and open it with your favorite editor. Something like TextWrangler. And then add your key-value pairs.

如果您想以 XML 格式查看它,只需找到 plist 文件并使用您喜欢的编辑器打开它。类似 TextWrangler 的东西。然后添加您的键值对。

回答by yoAlex5

One more quick action is using Version editor

另一个快速操作是使用 Version editor

enter image description here

在此处输入图片说明