私はこれで考えられるあらゆる方法を試しましたが、うまくいきませんでした。
次のようなエントリを持つ XML ファイルがあります...
<lat>53.358242</lat>
<lon>-6.227800</lon>
ファイルは NSXMLParser で解析され、他のものを取得しますが、これらを注釈にフィードしてピンをドロップすることはできません。.h ファイルには次のものがあります。
@interface LocationList : NSObject
@property (nonatomic, strong) NSString *loc_name;
@property (nonatomic, strong) NSString *lat;
@property (nonatomic, strong) NSString *lon;
次に、NSStringを座標に変換しようとします..
CLLocationCoordinate2D pinCoordinate;
pinCoordinate.latitude = [theLocationList.lat doubleValue];
pinCoordinate.longitude = [theLocationList.lon doubleValue];
しかし、私は0で終わります。
これを試してみましたが、負の値を処理できませんでした。
NSString *digits = [theLocationList.lon stringByTrimmingCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];
NSLog(@"Attempts: %f", [digits floatValue]);
私に掘り下げてくれる人はいますか?