これを参照して無効にすることはできません。関数を作成して呼び出すだけで他のクラスでvoidを実行できますが、このクラスにはビューがロードされていません。Qは、どうやって実行するのですか?
他のクラスの変数を参照しようとしましたが、コンパイラ エラーが発生します。
getCoords からの戻り値は、座標であるため double 型でなければなりません。
#import "OmarAnnotation.h"
#import <CommonCrypto/CommonHMAC.h>
#import <netdb.h>
#import "AppDelegate.h"
#import "MapViewController.h"
@implementation SFAnnotation
@synthesize image;
@synthesize latitude;
@synthesize longitude;
@synthesize string;
+(void) getCoords {
NSString *string = @"http://jerwuqu.info/iambored/?GETPOS";
NSURL *url = [NSURL URLWithString:string];
NSString *otherURLContents = [NSString stringWithContentsOfURL:url];
NSLog(otherURLContents);
NSArray* foo = [otherURLContents componentsSeparatedByString: @","];
NSString *longi = [foo objectAtIndex: 0];
NSString *lati = [foo objectAtIndex: 1];
NSLog(longi);
NSLog(lati);
double latiDouble = [lati doubleValue];
double longiDouble = [longi doubleValue];
}
- (CLLocationCoordinate2D)coordinate;
{
double extern *latiDouble;
double extern *longiDouble;
CLLocationCoordinate2D theCoordinate;
theCoordinate.latitude = latiDouble;
theCoordinate.longitude = longiDouble;
return theCoordinate;
}
- (void)dealloc
{
[image release];
[super dealloc];
}
- (NSString *)title
{
return @"Omar";
}
// optional
- (NSString *)subtitle
{
return @"Ortdenhegen";
}
@end
//これは他のクラス ファイル内の私の viewDidLoad です
- (void)viewDidLoad
{
self.mapView.mapType = MKMapTypeStandard; //Satelite?
self.mapAnnotations = [[NSMutableArray alloc] initWithCapacity:2];
SFAnnotation *sfAnnotation = [[SFAnnotation alloc] init];
[self.mapAnnotations insertObject:sfAnnotation atIndex:0];
[SFAnnotation getCoords]; // <- The line with an error
[self cityAction:self];
[self gotoLocation];
}