开发者

Silent Install in Objective C

开发者 https://www.devze.com 2023-02-27 04:51 出处:网络
When I run the following command on a command line, I am able to silently install the package but when I put t开发者_运维知识库he following code in a objective c program and run it. The package does n

When I run the following command on a command line, I am able to silently install the package but when I put t开发者_运维知识库he following code in a objective c program and run it. The package does not get installed.

Shell command -

echo password | sudo -S installer -pkg /Users/prashanth/Desktop/AppTest.mpkg -target /

Objective C -

system(@"echo password | sudo -S installer -pkg /Users/prashanth/Desktop/AppTest.mpkg -target /");


The system() function does not take an NSString. Get rid of the @.

However, I don't recommend this. It pretty much defeats the point of having an administrator password. Anyone with read access to the app binary or the ability to see just the names of running programs will be able to see the password in plaintext.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号