Когда я вызываю эту функцию, кажется, что она возвращает указатель вместо int. Когда я пытаюсь вернуть NSLog возвращаемое значение, я получаю предупреждение «Передача аргумента 1 NSLog из несовместимого типа указателя». И если NSLog запускается, он падает.
Это связано с тем, что это статический метод? Как я могу вернуть реальный int?
Я использую SDK 3.0
Вот рассматриваемая функция:
+(int) getZoomFromExtent: (CLLocationCoordinate2D)bottomLeft
withTopRight:(CLLocationCoordinate2D)topRight
withPixelsX:(int)pixelsX
withPixelsY:(int)pixelsY
withMapContents: (RMMapContents*) contents;
Вот код .h:
#import <Foundation/Foundation.h>
#import <math.h>
#import <CoreLocation/CLLocation.h>
#import "RMTile.h"
#import "RMMapContents.h"
@interface AnnasMath : NSObject {}
+(CLLocationCoordinate2D) normalizePixelCoords:(CLLocationCoordinate2D) point;
+(RMTile)tileWithCoordinate:(CLLocationCoordinate2D)point andZoom:(int)zoom;
+(NSArray *)getTileArrayWithUpperLeft:(CLLocationCoordinate2D)upperLeft andLowerRight: (CLLocationCoordinate2D)lowerRight fromZoom:(int)bottomZoom toZoom:(int)topZoom;
+(int)getTileCountWithUpperLeft:(CLLocationCoordinate2D)upperLeft andLowerRight:(CLLocationCoordinate2D)lowerRight fromZoom:(int)bottomZoom toZoom:(int)topZoom;
+(int) getZoomFromExtent: (CLLocationCoordinate2D)bottomLeft
withTopRight: (CLLocationCoordinate2D)topRight
withPixelsX:(int)pixelsX
withPixelsY:(int)pixelsY
withMapContents: (RMMapContents*) contents;
@конец
Вот начало кода .m:
#import "AnnasMath.h"
#import <Foundation/Foundation.h>
#import <math.h>
#import "TileWrapper.h"
@implementation AnnasMath
...
Я использую его следующим образом:
int zoom = [AnnasMath getZoomFromExtent:[[extent objectForKey:@"bottomLeft"]coordinate]
withTopRight:[[extent objectForKey:@"topRight"]coordinate]
withPixelsX:300
withPixelsY:300
withMapContents:t.mapVC.mapView.contents];
NSLog("About to set the zoom to %i", zoom);