在OSX中创建许可协议屏幕

时间:2017-12-19 12:16:27

标签: objective-c swift xcode macos

我正在尝试实现许可协议,如附图中所示,我可以以相同的方式创建一个新的WindowController和设计,但我想知道我们是否在Xcode中有任何默认屏幕来做这种事情,因为我注意到大多数应用程序都有类似的设计。 enter image description here

2 个答案:

答案 0 :(得分:1)

这是一个磁盘安装许可协议。您可以将许可协议嵌入到DMG磁盘映像中,以便在用户安装映像时使用此屏幕显示。

DMG license agreement

如果您的申请位于example/Example.app,则可以创建example.dmg,并将EULA.txt嵌入其中,如下所示:

hdiutil create -srcfolder example/ -volname "Example" "example.dmg"
./eula_into_dmg.sh "example.dmg" "EULA.txt"
# you should also codesign the dmg if you're going to distribute it:
codesign -s "$CODE_SIGN_IDENTITY" -v "$dmg"

这是eula_into_dmg.sh

#!/bin/bash -u

if [[ $# -ne 2 ]]; then
    echo "Usage: $0 <dmg> <license>"
    exit 1
fi

prefix=$(base64 -D <<<\
H4sIAJtVUFoCA4VWW2vbSBh9bn7Fh3ahbci6o9FcLPahJJIMBbcNjaH7qjpyYupaiyW3pGX/+55vpJF1\
ianBYmTjo/Ody4zv8zqnl6v3t8uX9CqU8ysKlrfbdfCafl28+DMII6XIaGPIhFaTSawiKVSCW5ORsfxZ\
aGxAvdebS5qlxSY/7mpa5vuHY/5Al28YzWgpSMWAVEpb0hIroVVEZsFAGcDVQkVjtILepennT+ksKY/7\
+mPSoqlM4+dKXpO8dhfQ0hE+U5G4IRvZGBcpxmgfVrNLvJZ3q2RWPVXkuSUmBAVjeb4YBMFNWy2xCjFp\
YhZkIhOO0XYY0NPbleu8Q8OkVhrtKDQzSyHnmJS1NBYza6smaHQoKsDRq3KzqYq6RZMCPwIaKKRAi3SE\
i8DlJGMoIjlGo82h/EZaCOHoSY+WGkk2tmws0E6DW80rC9LRQk24/fXlqS7cvDC0eJu2aK1GQnkXcFGJ\
jkiD3ABjgMaEWhsyRvrv74uLe5dFjh+yyLTbEGIlCG9JfjW6KLeahHD0Gj7mbvXpj/YxyHy2f9htq0f6\
cqzrcl8FpycbEqnSjUCQijNl5vDSyQcbrYrCZ57sAeuiqsNWKkSd9bWSG6VJzLlbMUchZPU5LUYLPUG7\
fjgUxSzdVrlbeOEFA8WooVUCKUA4yRpgyExmuFj4EBszRrs9bPf17C7/XoDlz3ebLmKoi6shwtZniS8s\
swTV+bRM9FQeydGiH9v60ZfJKmjk0oWV5tHSpggu/o14cxOP0erHAoIdvlVUbnCz9WhRE9OYG+j2CW6P\
TJhq1H1xM0araLddF/uquKI1Vl+7SSUC21Mctw2jBT8mZEg8ZjJp4GwIqC4pX6+LjhvI+IGcWlEzpFWs\
W+hklNmEW+WGrcpN/SM/dJ6Cm3Cu0cAPzy3DDmDVMy4QfGQn7kval3W3pfWHZLVstyc50qyDmrrg7Lyi\
f7EVVRSkJxeGucikPFPv4aRNaINz7ZOn9g1bZ6etGxbofOuaxvjWnakZDQs0PcJ835rG+NZNanbzjGGT\
HaHt26/Wp+6YOFMzGhZojHbqW9MY79CZmtGwQGO0U9+axnhuvZo9Exyv5RjN9a3NDttwOvoHNXOyR3wb\
GvybSNqZJ0e/69t2X9X5bgeK/T8SiMSCj1JF1rIpsjFFNAe4MdOe9AvHlfG6xdwrdxYqrOBfxk6q0VY4\
RusVLu/lTbpZXLbc+cDaSznJ4BitVziXu4Fu2W+bNtFtdNytsn9W0+PubnntSvc/iogHYQYKAAA= | gunzip -)

suffix=$(base64 -D <<<\
H4sIANNVUFoCA6u15uJKSSxJVFAvLqnMUVfQMDUwMNBRUHLNS8/JLM5QCPZxVNJUqObiVFECShgrAAkD\
OOEMIiyBhKEJQkJJAQnoaynowcAxCKWgpQ81zUABgzAyRzMXp2nqEBNhphliMw3JXEewuThNAwEtZLeh\
+wqNQDEIbtoxZONAZtVacwEAUriwzWEBAAA= | gunzip -)

temp=$(mktemp)
echo -n "$prefix" > "$temp"
cat "$2" | dd conv=swab | hexdump -v -e '8/2 "%04x " "\n"' | sed -e 's/ *$//' -e 's/^/        $"/' -e 's/$/"/' >> "$temp"
echo -n "$suffix" >> "$temp"

hdiutil unflatten "$1"
Rez -a "$temp" -o "$1"
hdiutil flatten "$1"
rm "$temp"

答案 1 :(得分:-1)

没有默认的UI元素,也没有一个众所周知的社区选项。最好的选择是设计自己的。