app服务器证书无效怎么办,APP上架证书无效:解决(示例代码)

博客讲述了在iOS开发中遇到的erroritms-9000错误,该错误与证书签名有关。作者在重置Keychain后,证书出现问题,导致应用无法正常签名。通过逐步排查,发现是缺少AppleWorldwideDeveloperRelationsCertificationAuthority证书的信任设置导致。修复证书的信任权限后,问题得到解决。整个过程涉及到了证书的重置、打包、签名验证等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在碰到问题时总是第一反应,“我没做过啥啊”,这主观思想导致了排查问题更加困难。

screenshot1.jpg

上传之后出现如图错误,”error itms-9000 the bundle at bundle path is not signed using an apple submission certificate”

由于最近某些原因,我将keychain给重置了一下,当时申请的CertificateSigningRequest.certSigningRequest文件也已失效,再看错误日志,我怀疑是证书的问题。

随后将所有的证书重新搞了一遍。问题依然存在。

接着用继续排查,用release证书打包出来一个.app,举例如AppName.app

然后用命令行来检测证书

$codesign -vvvv AppName.app

AppName.app:CSSMERR_TP_NOT_TRUSTED

OK,终于找到了明确的错误代码了。google了一下发现是因为缺少了“Apple Woldwide Developer Relations Certification Authority”这个证书导致。

接着查看keychain,发现证书存在。只不过由于我之前折腾的时候把证书信任权限给改了,接着就出现了问题。

%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7-2014-04-15-%E4%B8%8A%E5%8D%8811.40.10.png

将“使用此证书”改回“使用系统默认”

再次编译,检测一下证书

$codesign -vvvv AppName.app

AppName.app:valid on disk

AppName.app:satisfies its DesignatedRequirement

OK,问题解除。

// pages/admin/movies/movies.js Page({ data: { movies: [], // 电影列表 loading: false, // 是否加载中 hasMore: true, // 是否还有更多数据 page: 1, // 当前页码 pageSize: 10, // 每页数量 searchValue: '', // 搜索框值 showAddModal: false, // 是否显示添加电影模态框 movieForm: { name: '', poster: '', type: '', director: '', actors: '', description: '', rating: 0, releaseDate: '', duration: '', status: 1 }, formErrors: {} // 表单错误信息 }, onLoad: function(options) { this.getMovies(); }, // 获取电影列表 getMovies() { if (this.data.loading || !this.data.hasMore) return; this.setData({ loading: true }); wx.request({ url: `${getApp().globalData.baseUrl}/admin/api/movies`, data: { page: this.data.page, pageSize: this.data.pageSize, keyword: this.data.searchValue }, success: (res) => { if (res.data.code === 0) { const newMovies = res.data.data.list; const hasMore = res.data.data.list.length >= this.data.pageSize; this.setData({ movies: this.data.page === 1 ? newMovies : [...this.data.movies, ...newMovies], hasMore, page: this.data.page + 1 }); } }, complete: () => { this.setData({ loading: false }); } }); }, // 搜索框输入 onSearchInput(e) { this.setData({ searchValue: e.detail.value }); }, // 搜索确认 onSearchConfirm() { this.setData({ page: 1, hasMore: true, movies: [] }); this.getMovies(); }, // 显示添加电影模态框 showAddMovieModal() { this.setData({ showAddModal: true, movieForm: { name: '', poster: '', type: '', director: '', actors: '', description: '', rating: 0, releaseDate: '', duration: '', status: 1 }, formErrors: {} }); }, // 关闭添加电影模态框 closeAddMovieModal() { this.setData({ showAddModal: false }); }, // 表单输入 onFormInput(e) { const { field } = e.currentTarget.dataset; const { value } = e.detail; this.setData({ [`movieForm.${field}`]: value }); }, // 日期选择 onDateChange(e) { this.setData({ 'movieForm.releaseDate': e.detail.value }); }, // 评分选择 onRatingChange(e) { this.setData({ 'movieForm.rating': e.detail.value }); }, // 提交表单 submitForm() { const { movieForm } = this.data; const errors = {}; // 表单验证 if (!movieForm.name.trim()) { errors.name = '请输入电影名称'; } if (!movieForm.poster.trim()) { errors.poster = '请上传电影海报'; } if (!movieForm.type.trim()) { errors.type = '请输入电影类型'; } if (!movieForm.director.trim()) { errors.director = '请输入导演'; } if (!movieForm.actors.trim()) { errors.actors = '请输入主演'; } if (!movieForm.description.trim()) { errors.description = '请输入电影简介'; } if (!movieForm.releaseDate) { errors.releaseDate = '请选择上映日期'; } if (!movieForm.duration.trim()) { errors.duration = '请输入电影时长'; } if (Object.keys(errors).length > 0) { this.setData({ formErrors: errors }); return; } // 提交表单 wx.showLoading({ title: '提交中...', mask: true }); wx.request({ url: `${getApp().globalData.baseUrl}/admin/api/movies`, method: 'POST', data: movieForm, success: (res) => { if (res.data.code === 0) { wx.showToast({ title: '添加成功', icon: 'success' }); // 刷新电影列表 this.setData({ page: 1, hasMore: true, movies: [], showAddModal: false }); this.getMovies(); } else { wx.showToast({ title: res.data.message || '添加失败', icon: 'none' }); } }, fail: () => { wx.showToast({ title: '网络错误,请稍后重试', icon: 'none' }); }, complete: () => { wx.hideLoading(); } }); }, // 上传海报 uploadPoster() { wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: (res) => { const tempFilePaths = res.tempFilePaths; // 上传图片到服务器 wx.showLoading({ title: '上传中...', }); wx.uploadFile({ url: `${getApp().globalData.baseUrl}/admin/api/upload`, filePath: tempFilePaths[0], name: 'file', success: (res) => { const data = JSON.parse(res.data); if (data.code === 0) { this.setData({ 'movieForm.poster': data.data.url }); wx.showToast({ title: '上传成功', icon: 'success' }); } else { wx.showToast({ title: data.message || '上传失败', icon: 'none' }); } }, fail: () => { wx.showToast({ title: '网络错误,请稍后重试', icon: 'none' }); }, complete: () => { wx.hideLoading(); } }); } }); }, // 编辑电影 editMovie(e) { const index = e.currentTarget.dataset.index; const movie = this.data.movies[index]; this.setData({ showAddModal: true, movieForm: { id: movie.id, name: movie.name, poster: movie.poster, type: movie.type, director: movie.director, actors: movie.actors, description: movie.description, rating: movie.rating, releaseDate: movie.releaseDate, duration: movie.duration, status: movie.status }, formErrors: {} }); }, // 删除电影 deleteMovie(e) { const index = e.currentTarget.dataset.index; const movieId = this.data.movies[index].id; wx.showModal({ title: '确认删除', content: '您确定要删除这部电影吗?', success: (res) => { if (res.confirm) { wx.showLoading({ title: '删除中...', }); wx.request({ url: `${getApp().globalData.baseUrl}/admin/api/movies/${movieId}`, method: 'DELETE', success: (res) => { if (res.data.code === 0) { // 从列表中删除电影 const movies = [...this.data.movies]; movies.splice(index, 1); this.setData({ movies }); wx.showToast({ title: '删除成功', icon: 'success' }); } else { wx.showToast({ title: res.data.message || '删除失败', icon: 'none' }); } }, fail: () => { wx.showToast({ title: '网络错误,请稍后重试', icon: 'none' }); }, complete: () => { wx.hideLoading(); } }); } } }); }, // 更改电影状态 changeMovieStatus(e) { const index = e.currentTarget.dataset.index; const movie = this.data.movies[index]; const newStatus = movie.status === 1 ? 0 : 1; wx.showLoading({ title: '更新中...', }); wx.request({ url: `${getApp().globalData.baseUrl}/admin/api/movies/${movie.id}/status`, method: 'POST', data: { status: newStatus }, success: (res) => { if (res.data.code === 0) { // 更新列表中的电影状态 const movies = [...this.data.movies]; movies[index].status = newStatus; this.setData({ movies }); wx.showToast({ title: newStatus === 1 ? '已上架' : '已下架', icon: 'success' }); } else { wx.showToast({ title: res.data.message || '更新失败', icon: 'none' }); } }, fail: () => { wx.showToast({ title: '网络错误,请稍后重试', icon: 'none' }); }, complete: () => { wx.hideLoading(); } }); } }); 有没有问题
最新发布
06-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值