小编toa*_*ead的帖子

JAXB将嵌套元素解组为空

XML片段:

<datasource formatted-name="blah" inline="blah">
    <repository-location derived-from="blah" id="blah" path="blah" revision="blah" site="blah"/>
</datasource>
Run Code Online (Sandbox Code Playgroud)

我试图用嵌套的静态类解组一个类(DataSource)下的所有东西.这是我的DataSource类:

@XmlRootElement(name = "datasource")
@XmlAccessorType(XmlAccessType.FIELD)
public class DataSource {

    @XmlAttribute(name = "formatted-name")
    protected String formattedName;
    @XmlAttribute(name = "inline")
    protected String inline;
    @XmlElement(name = "repository-location")
    protected RepositoryLocation repositoryLocation;

    // public getters and setters for fields above

    @XmlAccessorType(XmlAccessType.FIELD)
    public static class RepositoryLocation {

        @XmlAttribute(name = "derived-from")
        protected String derivedFrom;
        @XmlAttribute(name = "id")
        protected String id;
        @XmlAttribute(name = "path")
        protected String path;
        @XmlAttribute(name = "revision")
        protected String revision;
        @XmlAttribute(name = "site")
        protected …
Run Code Online (Sandbox Code Playgroud)

java xml jaxb unmarshalling

8
推荐指数
1
解决办法
844
查看次数

requestWhenInUseAuthorization()在iOS 8中不起作用Info.plist中的NSLocationWhenInUseUsageDescription键

我正在使用iOS SDK 8.1尝试调用requestWhenInUseAuthorization()方法来提示用户授予对我的应用程序的访问权限.我导入了CoreLocation.framework,并将NSLocationWhenInUseUsageDescription和NSLocationAlwaysUsageDescription键添加到info.plist中.当我运行应用程序时,它从未提示我进行位置访问.以下是我的代码,我错过了什么?

import UIKit
import CoreLocation
import MapKit

class ViewController: UIViewController, CLLocationManagerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        var manager = CLLocationManager()
        manager.delegate = self
        manager.desiredAccuracy = kCLLocationAccuracyBest

        let authorizationStatus = CLLocationManager.authorizationStatus()
        switch authorizationStatus {
        case .Authorized:
            println("authorized")
        case .AuthorizedWhenInUse:
            println("authorized when in use")
        case .Denied:
            println("denied")
        case .NotDetermined:
            println("not determined")
        case .Restricted:
            println("restricted")
        }

        manager.requestWhenInUseAuthorization()
        manager.startUpdatingLocation()

    }

    func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
        let location = locations[0] as CLLocation
        println("Latitude: \(location.coordinate.latitude). Longitude: \(location.coordinate.longitude).")
    }

    func locationManager(manager: CLLocationManager!, …
Run Code Online (Sandbox Code Playgroud)

core-location swift ios8

4
推荐指数
1
解决办法
8673
查看次数

标签 统计

core-location ×1

ios8 ×1

java ×1

jaxb ×1

swift ×1

unmarshalling ×1

xml ×1