Mac app is still running after deleting Info.plist

冷暖自知 提交于 2020-01-06 14:45:28

问题


I want to build a Mac App from scratch. I manually created the required folders of main app, Contents, MacOS, Resources, and dropped the binaries. The only one I don't know how to create from scratch is "Info.plist". So, I just copied one from the installed Applications on my machine, removed all the unfamiliar keys, except the Executable and Package type (as APP).

Then I did a test. Before I copied and editted the Info.plist file, I double-clicked the app icon in Finder. Not working, which is expected. After I copied and editted the Info.plist file, it is working, which is also expected. Next is what I don't understand. I removed the Info.plist file, and double-clicked the app icon in Finder, it is STILL working!

My question is:

  1. Did the first time running migrate the Info.plist information to some secret place in the app bundle?
  2. Is copying and editing an existing Info.plist file from other applications a good practice for building an app from scratch?

回答1:


I know the post is old but think to answer,so that users will get benefitted as they come across this.You asked two questions:-

1)See the first run has a build and its derived data might help you to run without Info.plist(for particular case although i didn't think so it run). But you can't run app without info.plist.

2)No.the answer is copying and editing an existing info.plist from other application is not a good practice.

Every app and plug-in uses an Info.plist file to store configuration data in a place where the system can easily access it. OS X and iOS use Info.plist files to determine what icon to display for a bundle, what document types an app supports, and many other behaviors that have an impact outside the bundle itself. For better knowledge about this you can see this link:-

https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Introduction/Introduction.html

I think the user who asked this already got these things,Hope this will help other Users.

Thanks.



来源:https://stackoverflow.com/questions/18387691/mac-app-is-still-running-after-deleting-info-plist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!