CLLocation对象在swift中具有纬度和经度

时间:2017-11-12 09:50:56

标签: objective-c swift cllocation

我会尝试设置CLLocation对象的纬度和经度属性,但运行时出现此错误:

  

无法将CLlocation对象转换为EMTrackPoint对象

enter image description here

for element in objectsArray {
    let item = CLLocation(latitude: element.latitude, longitude: element.longitude) as! EMTrackPoint

    item.mElevation = element.ele
    item.mOrientation = element.orientation
    item.mDate = Date()
    if element.poiActive != ""{
         GPXActive.add(element.poiActive.components(separatedBy: ","))
    }
    GPXDanger.add(element.dangerActive.components(separatedBy: ","))
    item.mActivePOIs = GPXActive
    item.mActiveDangers = GPXDanger
    GPXPoints.add(item)
}

目标C中的EMTrackPoint类:

@interface EMTrackPoint : CLLocation

@property (nonatomic, assign) double mElevation;
@property (nonatomic, retain) NSDate *mDate;
@property (nonatomic, retain) NSMutableArray *mActivePOIs;
@property (nonatomic, retain) NSMutableArray *mActiveDangers;
@property (nonatomic, assign) double mOrientation;
@property (nonatomic, assign) double mSpeed;

请帮忙。

1 个答案:

答案 0 :(得分:0)

每个a.filter(function(item) { return !finalArray.contains(item)); }); 也是import xmlrpclib url = "https://myodoo.com" db = "mydb" username = '123' password = '123' models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url)) new_id = 12 # id of existing sale order model_name = 'sale.order' models.execute_kw(db, uid, password, model_name, 'action_invoice_create', [new_id]) ,那么为什么不首先初始化EMTrackPoint实例而不是进行类型转换:

CLLocation