Mac app is still running after deleting Info.plist

2019-08-27 04:26发布

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条回答
三岁会撩人
2楼-- · 2019-08-27 05:06

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.

查看更多
登录 后发表回答