收藏
回答

隐私协议已声明摄像头, 但是调用chooseMedia接口还是没反应, 这是为什么?

错误信息:{"errMsg": "chooseMedia:fail api scope is not declared in the privacy agreement", "errno": 112}
wx.getSetting({
						success(res){
							if(!res.authSetting['scope.camera']){
								wx.authorize({
									scope: 'scope.camera',
									success(){
										uni.chooseMedia({
											count:1,
											mediaType:["image"],
											sourceType:['album','camera'],
											sizeType:['original','compressed'],
											camera:"back",
											success: function(res){
												console.log(res)
												var file = res.tempFiles;
												file = file[0];
												file = file.tempFilePath
												var suffix =file.substring(file.lastIndexOf(".")+1);//txt
												_this.goJump('/pages/search/result/image?url='+file+"&fileType="+suffix);
											},
											fail: function(err){
												console.log('开启摄像头失败')
												console.log(err)
											}
										})
									},
									fail(err){
										console.log(err)
									}
								})
							}else{
								uni.chooseMedia({
									count:1,
									mediaType:["image"],
									sourceType:['album','camera'],
									sizeType:['original','compressed'],
									camera:"back",
									success: function(res){
										console.log(res)
										var file = res.tempFiles;
										file = file[0];
										file = file.tempFilePath
										var suffix =file.substring(file.lastIndexOf(".")+1);//txt
										_this.goJump('/pages/search/result/image?url='+file+"&fileType="+suffix);
									},
									fail: function(err){
										console.log('开启摄像头失败')
										console.log(err)
									}
								})
							}
						},
						fail(err){
							console.log(err)
						}
					})


最后一次编辑于  2023-12-13
回答关注问题邀请回答
收藏
登录 后发表内容