AppleScript 创建IOS 描述配置文件

最近接触要用到iPhone 手机配置描述文件。

首先,苹果有一个专门生成配置描述文件的工具:iPhone 配置描述工具,需要的话可以去苹果官网找找,手动创建配置描述文件,还算容易的。

由于项目需要,需要描述文件自动根据请求内容自动生成,所以就要做成服务端生成,用脚本自动生成现在还碰到一个问题是,怎么获取用脚本获取传递过来的参数,并把参数传递到脚本中,暂时还没解决。

mac平台下就需要用AppleScript 脚本语言,第一感觉applescript很不友好,确实都看不懂,说明文档列看了一会,还是不知道怎么下手。

google 资料比较少,不过东拼西凑还是可以,下面是自己写的一个wifi 配置描述文件。

tell application "iPhone Configuration Utility"

set myconfigureto make newconfiguration profilewith properties {displayed name:"heitan",profile identifier:"com.heitan.wifi"}

tell myconfigure

set mywifipayloadto makenewWiFi payload of myconfigure with properties {service set identifier:"heitan",password:"12345678"}

tell mywifipayload

make newtrusted server certificateof mywifipayloadwith properties {certificate name:"heitan"}

end tell

end tell

export myconfigureto "~/testwifi"

end tell


1、如何在终端运行applescript脚本

命令:osascript scriptname(scriptname:脚本名称)


2、如何从执行脚本命令中获取参数

命令:osascript scriptname heitan 12345678

on run argv

set username1 to text of "" & item 1 of argv & ""

set userpwd to text of "" & item 2 of argv & ""

end run

一下图片是通过命令,动态创建wifi配置描述文件。


你可能感兴趣的:(iPhone,配置描述文件,ios,脚本语言,application,iphone,applescript)