首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我共同设计我的Mac应用程序时,API调用不运行

当我共同设计我的Mac应用程序时,API调用不运行
EN

Stack Overflow用户
提问于 2015-09-03 15:38:15
回答 1查看 599关注 0票数 2

我试图签署我的Mac的make部署,但当我签署我的捆绑应用程序,它不进行网络通话。

该应用程序是在cpp中使用Qt开发的。

PKG生成步骤

这是我的脚本来共同设计这个应用程序

在二进制中集成了框架

代码语言:javascript
复制
macdeployqt MyAppName.app

检查在确定时是否一切正常

代码语言:javascript
复制
dsymutil MyAppName.app/Contents/MacOS/MyAppName -o MyAppName.app.dSYM

符号框架

代码语言:javascript
复制
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 

(在这一步之前,应用程序运行得相当好)

符号包应用程序

代码语言:javascript
复制
codesign --deep --entitlements ../myappname_desktop/MyAppName.entitlements -s "3rd Party Mac Developer Application: MyAppName" MyAppName.app

生成PKG

代码语言:javascript
复制
productbuild --component MyAppName.app /Applications --sign "3rd Party Mac Developer Installer: MyAppName" MyAppName.pkg

MyAppName.entitlements

代码语言:javascript
复制
<?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

代码语言:javascript
复制
<?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>

束结构

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-03 16:14:44

传出网络访问要求将com.apple.security.network.client权限添加到您的权益文件中。有关完整列表,请参见应用程序沙箱权利键

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32379982

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档