When I call this function, it seems to return a pointer instead of an int. When I try and NSLog the return value, I get a warning "passing argument 1 of NSLog from incompatible pointer type." And if the NSLog runs, it crashes.
Does this have to do with this being a static method? How can I get back a real int?
I am using SDK 3.0
Here is the function in question:
+(int) getZoomFromExtent: (CLLocationCoordinate2D)bottomLeft
withTopRight:(CLLocationCoordinate2D)topRight
withPixelsX:(int)pixelsX
withPixelsY:(int)pixelsY
withMapContents: (RMMapContents*) contents;
Here is the .h code:
#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;
@end
Here is the beginning of the .m code:
#import "AnnasMath.h"
#import <Foundation/Foundation.h>
#import <math.h>
#import "TileWrapper.h"
@implementation AnnasMath
...
I am using it as follows:
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);