代码是这个
func getRouteData() -> [(Double)] {
// Return early if not a distance workout
guard self.shouldShowDistance else {
return []
}
let store = HKHealthStore()
let runningObjectQuery = HKQuery.predicateForObjects(from: self.workout)
let routeQuery = HKAnchoredObjectQuery(type: HKSeriesType.workoutRoute(), predicate: runningObjectQuery, anchor: nil, limit: HKObjectQueryNoLimit) { (query, samples, deletedObjects, anchor, error) in
guard error == nil else {
// Handle any errors here.
fatalError("query failed")
}
guard samples != nil else {
fatalError("No samples")
}
guard samples!.count > 0 else { fatalError("No samples") }
guard let route = samples?.first as? HKWorkoutRoute else {
fatalError("No samples")
}
// Create the route query.
let query = HKWorkoutRouteQuery(route: route) { (query, locationsOrNill, done, errorOrNil) in
// This block may be called multiple times.
if let error = errorOrNil {
// Handle any errors here.
return
}
guard let locations = locationsOrNil else {
fatalError("*** Invalid State: This can only fail if there was an error. ***")
}
// Do something with this batch of location data.
if done {
// The query returned all the location data associated with the route.
// Do something with the complete data set.
}
// You can stop the query by calling:
// store.stop(query)
}
store.execute(query)
}
store.execute(routeQuery)
return []
}
如果我更改<div class="login-form">
{{login}}
<form name="loginForm" action="" method="post" novalidate>
<h2 class="text-center"></h2>
<div class="form-group">
<input name="username" type="text" class="form-control" placeholder="Username"
ng-model="login.username" ng-required="true">
</div>
<div class="form-group">
<input name="password" type="password" class="form-control" placeholder="Password"
ng-model="login.password" ng-required="true">
</div>
<div class="form-group">
<input type="submit" value="Enviar" class="btn btn-primary btn-block" />
</div>
<div class="clearfix">
<label class="pull-left checkbox-inline">
<input type="checkbox"> Recordarme</label>
<br />
<a href="#" class="pull-right">Olvidaste tu Contraseña?</a>
</div>
</form>
<p class="text-center"><a href="#">Crear una cuenta</a></p>
</div>
,则对于用户名,该值未存储在对象中。我该怎么办?
答案 0 :(得分:2)
否,这不是问题,只有在其为合法电子邮件地址时,该电子邮件才会显示。因此,在绑定到模型之前,您需要输入有效的电子邮件地址。
尝试类似的东西
sa@99t.com