开发者

Silent Install in Objective C

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜