免费建官方网站,网站开发规划书,天津创思佳网络网站制作公司,网站开发费用是无形资产1、HarmonyOS 无法导入cardEmulation#xff1f;
在工程entry mudule里的index.ets文件里导入cardEmulation失败 可以按照下面方式添加SystemCapability#xff1b;在src/main/syscap.json(此文件需要手动创建#xff09;中添加如下内容
{devices: {gen…1、HarmonyOS 无法导入cardEmulation
在工程entry mudule里的index.ets文件里导入cardEmulation失败 可以按照下面方式添加SystemCapability在src/main/syscap.json(此文件需要手动创建中添加如下内容
{devices: {general: [//这里要和module.json5中设备类型保持一致phone]
},development: {addedSysCaps: [SystemCapability.Communication.NFC.CardEmulation]
}
}2、自定义装饰器ClassDecorator如何使用
ArkTS支持TS5.0之前的TS装饰器语法。关于装饰器的定义和运行时行为可以参考TS官方文档https://www.typescriptlang.org/docs/handbook/decorators.html。注意如果在ets文件中定义装饰器则需要同时满足ArkTS的语法规则比如不能使用any等。
以下是类装饰器、属性装饰器、方法装饰器、参数装饰器的简单示例
function TestClassDecorator (target: Function) {}
function TestMemberDecorator (target: testClass, memberName: String) {}
function TestFunDecorator (target: testClass, propertyName: String, descriptor: PropertyDescriptor) {}
function TestArgDecorator (target: Function, methodName: String, paramIndex: Number) {}TestClassDecorator
class testClass {TestMemberDecoratorcount: number 123;TestFunDecoratorTestFun(TestArgDecorator param: string) {}
}3、HarmonyOS 用户拨打电话时的CallState状态码变化顺序
用户拨打电话时(电话拨出)对方拒接、接听、未接听三种情况CallState状态码变化顺序 主动呼叫对方拒接/呼叫方响铃过程中提前挂断2 - 0 对方接听2 - 2(响铃过程中状态码是2)
4、HarmonyOS 文件key-value形式的自定义配置
需求为在app目录下存放各个模块都能读取的key-value形式的自定义配置并且value的类型不固定string、number、bool都有相关的json文件应该怎么创建和读取最好能直接用key读取出value而不需要先读取整个文件
在resources/base/element/下新建json文件 boolean.json 示例内容如下
{boolean: [{name: module_desc,value: true},{name: EntryAbility_desc,value: false},{name: EntryAbility_label,value: false}]
}使用资源管理接口调用getBoolean
import { common } from kit.AbilityKit;Entry
Component
struct Index {State message: string Hello World;private context getContext(this) as common.UIAbilityContext;build() {RelativeContainer() {Text(this.message).id(HelloWorld).fontSize(50).fontWeight(FontWeight.Bold).onClick((){let aa:boolean this.context.resourceManager.getBoolean($r(app.boolean.EntryAbility_desc).id)console.log(lujun EntryAbility_desc value is aa)}).alignRules({center: { anchor: __container__, align: VerticalAlign.Center },middle: { anchor: __container__, align: HorizontalAlign.Center }})}.height(100%).width(100%)}
}4、HarmonyOS 签名时报文件不支持的问题
在进行HarmonyOS app打包时发现报签名文件不支持的问题但签名文件我是通过命令直接生成的这个问题怎么解决 问题场景描述 使用签名命令生成签名文件
keytool -genkeypair -alias zofund -keyalg EC -sigalg SHA256withECDSA -dname CCN,Ozofund,OUzofund,CNzofund -keystore /Users/lidaofu/DevEcoStudioProjects\debug.p12 -storetype pkcs12 -validity 9125 -storepass *** -keypass **** 签名中profile应该时p7b文件。 具体的签名流程如下手动
生成CSR文件编辑器-----Build----Generate Key and CSR;已有p12选择已有否则选择新建填好AliasPassword等信息并牢记点击Finish完成----csr文件创建完成
申请调试签名证书
登录AppGallery Connect选择用户与访问左侧证书管理------新增证书选择上面生成的csr可以下载保存供后续使用左侧设备管理------添加相应的设备
申请调试profile
登录AppGallery Connect选择我的项目找到项目在项目中找到管理HAP Provision Profile可以管理pfofile
相关文档https://developer.huawei.com/consumer/cn/doc/app/agc-help-debug-app-0000001914423098