QtWebBrowser macOS签名问题

QtWebBrowser macOS签名问题,macos,qt,signing,qtwebengine,Macos,Qt,Signing,Qtwebengine,我最近遇到了一个与macOS上的QtWebBrowser相关的奇怪问题。QtWebEngine控件似乎没有加载到我的开发机器之外。我已经追踪到了签名。如果我构建了应用程序,但没有对其进行签名,那么我可以在另一台机器上正常运行它。我一签署应用程序,QtWebEngine控件就停止在其他机器上加载。更奇怪的是,当我回去测试一个旧版本时,它也做了同样的事情。这是一个版本,我建立和测试之前,肯定是工作。我相当肯定我正在测试的电脑从那时起就没有更新过 一些看起来可能是线索的东西是一个正在出现的警告。我不记

我最近遇到了一个与macOS上的QtWebBrowser相关的奇怪问题。QtWebEngine控件似乎没有加载到我的开发机器之外。我已经追踪到了签名。如果我构建了应用程序,但没有对其进行签名,那么我可以在另一台机器上正常运行它。我一签署应用程序,QtWebEngine控件就停止在其他机器上加载。更奇怪的是,当我回去测试一个旧版本时,它也做了同样的事情。这是一个版本,我建立和测试之前,肯定是工作。我相当肯定我正在测试的电脑从那时起就没有更新过

一些看起来可能是线索的东西是一个正在出现的警告。我不记得以前见过它

2019-04-28 22:11:30.247507-0700 QtWebEngineProcess[30607:140529] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x106f08560> (Domain: com.apple.universalaccess, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access

经过反复试验,我找到了解决这个问题的办法。我相当肯定,任何试图使用QtWebEngine对macOS应用程序进行公证的人都需要这样做。希望这能在将来节省一些时间

我的解决方案是使用com.apple.security.cs.disable-executable-page-protection异常对QtWebEngineProcess进行签名。以下是过程

使用以下命令对主应用程序进行签名

sudo codesign --deep --force --verify --verbose --sign "Developer ID Application: ***" --options runtime MyApp.app
sudo codesign --force --verify --verbose --sign "Developer ID Application: ***" --entitlements QtWebEngineProcess.entitlements --options runtime MyApp.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
sudo codesign --force --verify --verbose --sign "Developer ID Application: ***" --options runtime Output/MyApp.app/Contents/MacOS/MyApp
为QtWebEngineProcess创建权利文件

<?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.cs.disable-executable-page-protection</key>
    <true/>
</dict>
</plist>
使用以下命令对主可执行文件进行签名

sudo codesign --deep --force --verify --verbose --sign "Developer ID Application: ***" --options runtime MyApp.app
sudo codesign --force --verify --verbose --sign "Developer ID Application: ***" --entitlements QtWebEngineProcess.entitlements --options runtime MyApp.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess
sudo codesign --force --verify --verbose --sign "Developer ID Application: ***" --options runtime Output/MyApp.app/Contents/MacOS/MyApp
在遵循这些步骤之后,我能够成功地对申请进行公证

sudo codesign --deep --force --verify --verbose --sign "Developer ID Application: ***" --options runtime Output/MyApp.app