API 当我对我的 Mac OS X 应用程序进行代码签名时,调用不会 运行
API calls don't run when I codesign my Mac OS X app
我正在尝试为 Mac 商店部署签署我的 Mac OS X,但是当我签署我的捆绑应用程序时,它不会进行网络调用。
该应用程序是使用 Qt 在 cpp 中开发的
PKG生成步骤
这是我对应用程序进行代码签名的脚本
在二进制文件中集成框架
macdeployqt MyAppName.app
检查是否一切正常
dsymutil MyAppName.app/Contents/MacOS/MyAppName -o MyAppName.app.dSYM
符号框架
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/bearer/libqgenericbearer.dylib
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/imageformats/libq*
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/platforms/libqcocoa.dylib
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib
(到这一步,App运行的很好)
签署捆绑应用程序
codesign --deep --entitlements ../myappname_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app
生成 PKG
productbuild --component MyAppName.app /Applications --sign "3rd Party Mac Developer Installer: MyAppName" MyAppName.pkg
MyAppName.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>
MyAppName.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>MyAppName</string>
<key>CFBundleIdentifier</key>
<string>com.myappname.desktop</string>
<key>CFBundleVersion</key>
<string>4</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>ForAppStore</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
</dict>
</plist>
束结构
MyAppName.app
└── Contents
├── Frameworks
│ ├── QtCore.framework
│ │ ├── QtCore -> Versions/Current/QtCore
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtCore
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtDBus.framework
│ │ ├── QtDBus -> Versions/Current/QtDBus
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtDBus
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtGui.framework
│ │ ├── QtGui -> Versions/Current/QtGui
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtGui
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtNetwork.framework
│ │ ├── QtNetwork -> Versions/Current/QtNetwork
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtNetwork
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtPrintSupport.framework
│ │ ├── QtPrintSupport -> Versions/Current/QtPrintSupport
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtPrintSupport
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ └── QtWidgets.framework
│ ├── QtWidgets -> Versions/Current/QtWidgets
│ ├── Resources -> Versions/Current/Resources
│ └── Versions
│ ├── 5
│ │ ├── QtWidgets
│ │ └── Resources
│ │ └── Info.plist
│ └── Current -> 5
├── Info.plist
├── MacOS
│ └── Hightrack
├── PkgInfo
├── PlugIns
│ ├── bearer
│ │ ├── libqcorewlanbearer.dylib
│ │ └── libqgenericbearer.dylib
│ ├── imageformats
│ │ ├── libqdds.dylib
│ │ ├── libqgif.dylib
│ │ ├── libqicns.dylib
│ │ ├── libqico.dylib
│ │ ├── libqjp2.dylib
│ │ ├── libqjpeg.dylib
│ │ ├── libqmng.dylib
│ │ ├── libqtga.dylib
│ │ ├── libqtiff.dylib
│ │ ├── libqwbmp.dylib
│ │ └── libqwebp.dylib
│ ├── platforms
│ │ └── libqcocoa.dylib
│ └── printsupport
│ └── libcocoaprintersupport.dylib
└── Resources
├── empty.lproj
├── icon.icns
└── qt.conf
传出网络访问需要将 com.apple.security.network.client
授权添加到您的授权文件中。有关完整列表,请参阅 App Sandbox Entitlement Keys。
我正在尝试为 Mac 商店部署签署我的 Mac OS X,但是当我签署我的捆绑应用程序时,它不会进行网络调用。
该应用程序是使用 Qt 在 cpp 中开发的
PKG生成步骤
这是我对应用程序进行代码签名的脚本
在二进制文件中集成框架
macdeployqt MyAppName.app
检查是否一切正常
dsymutil MyAppName.app/Contents/MacOS/MyAppName -o MyAppName.app.dSYM
符号框架
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/bearer/libqgenericbearer.dylib
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/imageformats/libq*
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/platforms/libqcocoa.dylib
codesign --entitlements ../myappame_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib
(到这一步,App运行的很好)
签署捆绑应用程序
codesign --deep --entitlements ../myappname_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app
生成 PKG
productbuild --component MyAppName.app /Applications --sign "3rd Party Mac Developer Installer: MyAppName" MyAppName.pkg
MyAppName.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>
MyAppName.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>MyAppName</string>
<key>CFBundleIdentifier</key>
<string>com.myappname.desktop</string>
<key>CFBundleVersion</key>
<string>4</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSUIElement</key>
<string>1</string>
<key>ForAppStore</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
</dict>
</plist>
束结构
MyAppName.app
└── Contents
├── Frameworks
│ ├── QtCore.framework
│ │ ├── QtCore -> Versions/Current/QtCore
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtCore
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtDBus.framework
│ │ ├── QtDBus -> Versions/Current/QtDBus
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtDBus
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtGui.framework
│ │ ├── QtGui -> Versions/Current/QtGui
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtGui
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtNetwork.framework
│ │ ├── QtNetwork -> Versions/Current/QtNetwork
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtNetwork
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ ├── QtPrintSupport.framework
│ │ ├── QtPrintSupport -> Versions/Current/QtPrintSupport
│ │ ├── Resources -> Versions/Current/Resources
│ │ └── Versions
│ │ ├── 5
│ │ │ ├── QtPrintSupport
│ │ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current -> 5
│ └── QtWidgets.framework
│ ├── QtWidgets -> Versions/Current/QtWidgets
│ ├── Resources -> Versions/Current/Resources
│ └── Versions
│ ├── 5
│ │ ├── QtWidgets
│ │ └── Resources
│ │ └── Info.plist
│ └── Current -> 5
├── Info.plist
├── MacOS
│ └── Hightrack
├── PkgInfo
├── PlugIns
│ ├── bearer
│ │ ├── libqcorewlanbearer.dylib
│ │ └── libqgenericbearer.dylib
│ ├── imageformats
│ │ ├── libqdds.dylib
│ │ ├── libqgif.dylib
│ │ ├── libqicns.dylib
│ │ ├── libqico.dylib
│ │ ├── libqjp2.dylib
│ │ ├── libqjpeg.dylib
│ │ ├── libqmng.dylib
│ │ ├── libqtga.dylib
│ │ ├── libqtiff.dylib
│ │ ├── libqwbmp.dylib
│ │ └── libqwebp.dylib
│ ├── platforms
│ │ └── libqcocoa.dylib
│ └── printsupport
│ └── libcocoaprintersupport.dylib
└── Resources
├── empty.lproj
├── icon.icns
└── qt.conf
传出网络访问需要将 com.apple.security.network.client
授权添加到您的授权文件中。有关完整列表,请参阅 App Sandbox Entitlement Keys。