我正在练习这个名为NativeScript的新编程框架,它允许使用JS创建本机应用程序.但是,当我开始处理Hello World教程时,我收到此错误:
https://gist.github.com/longpham91/d603c8fe7f6c6b06e86f
当我尝试在终端上运行命令"tns run ios"时发生错误,这基本上允许NativeScript在我的手机上运行HelloWorld应用程序.
我还查看了错误日志,似乎错误可能与我的Xcode设备设置有关,如下所述:
检查依赖项代码签名错误:未找到代码签名标识:找不到与团队ID"(null)"匹配的有效签名标识(即证书和私钥对).CodeSign错误:SDK"iOS 8.4"中的产品类型"应用"需要代码签名
不过,我不确定这意味着什么.
我目前正在尝试弄清楚如何更改默认蓝色文本输入的下边框的颜色.我尝试使用border-color,color和background-color属性,但似乎没有对输入产生影响.这是我用于输入的XML代码 <TextField text="{{ username }}" cssClass="username" android:row="1"/>.
我刚刚在NativeScript应用程序上将核心模块更新到2.3.0,并且所有iOS和Android图像都变为灰色.
不知道为什么会发生这种情况,因为它在之前的版本中运行良好
我在开发nativescript时遇到了一些麻烦.我不知道如何在nativescript插件中获取Activity?
在android中:
import android.app.Activity;
import com.alipay.sdk.app.PayTask;
public Alipay(Activity activity) {
this.activity = activity;
PayTask alipay = new PayTask(activity);
String result = alipay.pay(payInfo);
}
Run Code Online (Sandbox Code Playgroud)
当我在nativescript中开发插件时.我写下这段代码:
var application = require("application");
var context = application.android.context;
//var context = application.android.foregroundActivity;
module.exports = {
startpay: function(orderInfo) {
var payTask = new com.alipay.sdk.app.PayTask(context);
return payTask.payV2(orderInfo,true);
}
};
Run Code Online (Sandbox Code Playgroud)
它可以使用com.alipay.sdk.app.PayTask().但背景是错误的.我试过
var context = application.android.context;
Run Code Online (Sandbox Code Playgroud)
和
var context = application.android.foregroundActivity;
Run Code Online (Sandbox Code Playgroud)
但是,当App运行时也有异常:
An uncaught Exception occurred on "main" thread. com.tns.NativeScriptException: Calling js method onClick failed
Error: …Run Code Online (Sandbox Code Playgroud) 我是nativescript的新手.我不知道如何给stacklayout提供border和border-radius.
下面我发布了我到目前为止所尝试的内容:
component.html:
<StackLayout class ="stackBorder" orientation="horizontal">
<Label text="Label 1" width="50" height="50" > </Label>
<Label text="Label 2" width="50" height="50" > </Label>
<Label text="Label 3" width="50" height="50" backgroundColor="white"> </Label>
<Label text="Label 4" width="50" height="50" backgroundColor="white"> </Label>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
component.css:
StackLayout {
margin: 10;
background-color: green;
}
.stackBorder {
border: 2px solid red;
border-radius: 8px;
}
Run Code Online (Sandbox Code Playgroud)
component.ts:
@Component({
selector: "sdk-child-component",
moduleId: module.id,
templateUrl: "./component.html",
styleUrls: ["./component.css"]
})
Run Code Online (Sandbox Code Playgroud)
最后我无法在stacklayout中看到边框.
我正在构建一个NS angular2应用程序,我遇到了TabView组件的默认行为的问题.我不希望它在创建组件时预加载所有数据.如何防止此行为发生.我只想在用户点击它时加载某个标签的数据.
这是我的tabview:
<TabView #tabview (selectedIndexChange)="onIndexChanged($event)" class="tab-view" sdkToggleNavButton>
<StackLayout *tabItem="{title: 'Summary', iconSource: 'res://ic_summary'}" >
<summary></summary>
</StackLayout>
<StackLayout *tabItem="{title: 'Dash', iconSource: 'res://ic_dashboard'}">
<dashboard></dashboard>
</StackLayout>
<StackLayout *tabItem="{title: 'My players', iconSource: 'res://ic_players'}" >
<myplayers></myplayers>
</StackLayout>
<StackLayout *tabItem="{title: 'Details', iconSource: 'res://ic_details'}" >
<playerdetails></playerdetails>
</StackLayout>
</TabView>
Run Code Online (Sandbox Code Playgroud)
我可以在tabview的相同.ts中调用onIndexChanged事件,但是我必须通知摘要,仪表板,内部组件.
需要通知的组件示例:
@Component({
selector: “summary”,
templateUrl: ‘summary.component.html’
})
export class SummaryView extends View {
constructor(args:Page){
super();
}
}
Run Code Online (Sandbox Code Playgroud) 我试图通过Xcode 7对给定的API执行POST请求.我的错误是:
UICollectionViewFlowLayout的行为未定义,因为:项高度必须小于UICollectionView的高度减去截面插入顶部和底部值,减去内容插入顶部和底部值.
相关的UICollectionViewFlowLayout实例是<_UIAlertControllerCollectionViewFlowLayout:0x7f99fe411ea0>,它附加到; layer =; contentOffset:{0,0}; contentSize:{0,0}>集合视图布局:<_ UIAlertControllerCollectionViewFlowLayout:0x7f99fe411ea0>.在UICollectionViewFlowLayoutBreakForInvalidSizes上创建一个符号断点,以在调试器中捕获它.
我试图执行的代码:
打字稿:
makeRatingCall(userRating) {
var score = userRating;
var film_edition_id = "123456789";
var computer_name = ConfigurationService.getUserData().user_username;
var api_key = "key";
return new Promise( function (resolve, reject) {
let xhr = new XMLHttpRequest();
xhr.open("POST", "my-url" + this.formatParams({film_edition_id, score, computer_name, api_key }), true);
xhr.setRequestHeader("Accept", "application/json");
xhr.onload = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
resolve(JSON.parse(xhr.responseText).err_code);
} else {
reject(xhr.responseText);
}
}
xhr.onerror = function( err ) {
reject ( …Run Code Online (Sandbox Code Playgroud) 在NativeScript应用程序的上下文中,我一直在努力寻找一种有效的,非hacky方式来做一些看似非常简单的事情:在布局的中心放置一个项目,在右边或左边放置另一个项目布局 - 类似于这个问题中的图像:中心和右对齐flexbox元素.这些项目应该都在一行中.(我已经查看了这些解决方案,但我不想添加一个伪元素,而且很多CSS只能用于NativeScript.)是否有某种干净,规范的方法来实现这一点默认布局?如果这不够"具体",请说我有这样的场景:
<SomeLayout>
<Label text="Center me"></Label>
<Label text="Pull me to the right"></Label>
</SomeLayout>
Run Code Online (Sandbox Code Playgroud)
标签的文本属性描述了我正在寻找的东西.请测试任何建议或确保它们有效.
我正在尝试使用FontAwesome图标集在NativeScript和Vue.js上构建应用程序,但由于我什至没有错误提示消息,所以无法解决问题。
我忠实地遵循文档,但没有任何反应。我到处搜寻,但是..一无所有。
如果您可以帮助我,我将非常感激。
文档:https : //nativescript-vue.org/blog/using-fonticons/
谢谢!
解
.fa { font-family: 'Font Awesome 5 Free', 'font-awesome/fa-regular-400'; }
.fas { font-family: 'Font Awesome 5 Free', 'font-awesome/fa-solid-900'; }
.fab { font-family: 'Font Awesome 5 Free', 'font-awesome/fa-brands-400'; }Run Code Online (Sandbox Code Playgroud)
字体家族的第一部分是命名字体家族,然后以逗号开头,我们将写出这些字体的路径。
当我执行 tns run ios 时,一切都很好,但是 tns run android 只是给了我这样的错误。我尝试了设备和模拟器,但结果相同。
我已经做好了:
错误代码:
Installing on device 2744b499...
Successfully installed on device with identifier '2744b499'.
Application org.nativescript.fagck_app is not running on device 2744b499.
This issue may be caused by:
* crash at startup (try `tns debug android --debug-brk` to check why it crashes)
* different application …Run Code Online (Sandbox Code Playgroud) nativescript ×10
android ×3
ios ×3
typescript ×3
xcode ×2
build ×1
css ×1
font-awesome ×1
javascript ×1
mobile ×1
plugins ×1
vue.js ×1
xcode7 ×1