error: "OpenGLESApp6" requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor. (in target 'OpenGLESApp6' from project 'OpenGLESApp6.iOS.Application')
真机调试(模拟器正常)时出现此错误需要到macos中操作
在xcode中先添加开发者账户: 菜单xcode->Preferences…
普通apple id也可以,但限制2个证书(还不能删,换电脑就卡在里面了),记得在钥匙串中备份证书.
然后打开该项目文件,设置好team签名
Undefined symbols for architecture arm64: "_OBJC_CLASS_$_AppDelegate", referenced from: objc-class-ref in main.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因是AppDelegate类只进行了声明 没有实现导致了.
而vs2019/2022中的模板文件AppDelegate.mm是空白的.
解决方式是为AppDelegate.mm文件添加代码
#import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate @end
visual studio 201x提示错误
Unable to start debugging. Unexecpted failure trying to reach vcremote: NotFound
vcremote提示错误
GET /debug/appRemotePath?package=com.bt_ios&deviceUdid=00008030-001305293E840000 404 1172.145 ms – 2
此处错误相关的js代码在以下文件
/usr/local/lib/node_modules/vcremote/node_modules/vcremote-lib/debugger/ios-debug.js
相关代码:
function getAppRemotePath(req, res) { var packageId = req.param("package"); var udid = req.param("deviceUdid", ""); var command = "ideviceinstaller -l -o xml"; if (udid.length > 0) { command = command + " -u " + udid; } Q.nfcall(child_process.exec, command + "> /tmp/$$.ideviceinstaller && echo /tmp/$$.ideviceinstaller").then(function (args) { // First find the path of the app on the device var filename = args[0].trim(); if (!/^\/tmp\/[0-9]+\.ideviceinstaller$/.test(filename)) { throw new Error("WrongInstalledAppsFile"); } var list = pl.parseFileSync(filename); fs.unlinkSync(filename); for (var i = 0; i < list.length; ++i) { if (list[i].CFBundleIdentifier == packageId) { var path = list[i].Path; return path; } } throw new Error("PackageNotInstalled"); }).then(function (remotePath) { res.status(200).send(remotePath); }).fail(function (reason) { res.status(404).json(reason); }).done(); }
实际上执行的就是这个命令: 列出所有的包信息.后面是手机udid.
ideviceinstaller -l -o xml -u 00008030-001305293E840000
udid在vcremote输出的的url能看到
或者使用命令 idevice_id -l
查看
如果以上命令不能执行,则解决相关库问题,如果以上能正常输出,就是包名问题了.
AppRemotePath是由url路径中的package参数去匹配手机所有app包信息中的CFBundleIdentifier字段.
自己判断即可,
CFBundleIdentifier字段其实就是在xcode中设置代码签名的Bundle Identifier,而此参数不能使用下划线
所以新建vs工程名时不要使用下划线
经测试,无法修改vs工程中的包名前缀,只能是com-_-.
Bundle Identifier 命名
Bundle Identifier:采用反域名命名规范,全部采用小写字母,以域名后缀+公司顶级域名+应用名形式命名,例如:app.eatm.test
仍然是同样的错误,但原因是npm中新安装的plist模块函数不一样造成的,仍然是appRemotePath函数中的问题,做如下修改
function logToFile(logText) { fs.appendFileSync("/tmp/test.txt", logText + '\n'); } function getAppRemotePath(req, res) { var packageId = req.param("package"); var xxx = packageId; var udid = req.param("deviceUdid", ""); var command = "ideviceinstaller -l -o xml"; if (udid.length > 0) { command = command + " -u " + udid; } new Promise(function (resolve, reject) { child_process.exec(command + "> /tmp/$$.ideviceinstaller && echo /tmp/$$.ideviceinstaller", (err, stout, sterr) => { logToFile("124"); if (err) { reject(sterr); } else { resolve(stout); } }); }).then(function (args) { // First find the path of the app on the device //这里我不知道为什么是args[0],args是一个字符串变量,不是数组 //Here, I don't know why it's args[0]. args is a string variable, not an array. //var filename = args[0].trim(); var filename = args.trim(); if (!/^\/tmp\/[0-9]+\.ideviceinstaller$/.test(filename)) { throw new Error("WrongInstalledAppsFile"); } //新安装的plist库没有parseFileSync这个函数 //The newly installed plist library does not have the function parseFileSync. //var list = pl.parseFileSync(filename); //fs.unlinkSync(filename); var list= pl.parse(fs.readFileSync(filename, 'utf8')); for (var i = 0; i < list.length; ++i) { if (list[i].CFBundleIdentifier == packageId) { var path = list[i].Path; return path; } } logToFile("没找到包"); throw new Error("PackageNotInstalled"); }).then(function (remotePath) { res.status(200).send(remotePath); }).catch(function (reason) { res.status(404).json(reason); }).finally(); }