我在尝试创建一个自动创建POST请求,发送它们,获取响应并处理它们的函数时遇到问题,然后显示UIAlertView告诉用户它是哪个问题.
这是我的代码:
let task = session.dataTaskWithRequest(request, completionHandler:{ (data, response, error) -> Void in
dispatch_async(dispatch_get_main_queue(),{
var alert = UIAlertController(title: "Chargement", message: "Envoi des informations...", preferredStyle: UIAlertControllerStyle.Alert)
viewController.presentViewController(alert, animated: true, completion: nil)
answer = NSString(data: data!, encoding: NSUTF8StringEncoding)!
print(answer)
var complete = false
alert.dismissViewControllerAnimated(true, completion: { () -> Void in
complete = true
})
while(!complete)
{
}
var textmsg: String
if(answer == "#400")
{
textmsg = "Il manque une information !"
}
else if(answer == "#50")
{
textmsg = "Le compte fourni …Run Code Online (Sandbox Code Playgroud) 我目前正在开发旧版 Angular 5 代码,除了使用 Angular CLI 生成组件时的默认测试之外,该代码没有任何单元测试。
\n\n该项目正在使用 Angular Material 5 RC0,单元测试似乎没有考虑我的模块的依赖关系。
\n\n应用程序模块.ts:
\n\n@NgModule({\n declarations: [\n AppComponent,\n /* My module components... */\n ],\n imports: [\n BrowserModule,\n FormsModule,\n HttpModule,\n ReactiveFormsModule,\n BrowserAnimationsModule,\n routing,\n DialogsModule,\n SharedModule ,\n MaterialModule,\n MatListModule, // It\'s the module that should be needed\n MatSidenavModule,\n ToastrModule.forRoot({\n timeOut: 5000,\n positionClass: \'toast-bottom-right\',\n preventDuplicates: true\n }),\n HttpClientModule,\n TableFactoryModule\n ],\n providers: [\n /* My module services */,\n AuthGuard\n ],\n bootstrap: [AppComponent]\n\n})\nexport class AppModule {\n\n}\nRun Code Online (Sandbox Code Playgroud)\n\n应用程序组件.ts:
\n\nimport { Component, Input, …Run Code Online (Sandbox Code Playgroud) 我正在尝试在按钮上建立可点击的链接。我使用一些Internet帮助进行了此操作,但没有成功:
@IBAction func linkClicked(sender: AnyObject) {
openUrl("http://fr.envisite.net/t5exce")
}
func openUrl(url:String!) {
let targetURL=NSURL(fileURLWithPath: url)
let application=UIApplication.sharedApplication()
application.openURL(targetURL);
}
Run Code Online (Sandbox Code Playgroud)
它什么也没做,没有错误,只是按钮没有使我进入Safari(我使用iOS模拟器)
我必须为我的单元测试声明一个列表:
public void DataCleanTest1()
{
List<MesureSerialized> data = new List<MesureSerialized>
{
{ new MesureSerialized() },
{ new MesureSerialized() }
};
}
Run Code Online (Sandbox Code Playgroud)
我想初始化我的对象并将它们填入一行,而不必手动设置对象的每个字段.
我不知道这个动作使用的术语所以我的研究没有成功.
ios ×2
swift ×2
.net ×1
angular ×1
angular5 ×1
c# ×1
dependencies ×1
swift2.3 ×1
typescript ×1
unit-testing ×1