Question

I inherited an xcode project whose author compiled with iOS 6.1. I understand apple has stopped accepting projects built using iOS6 SDK, but for whatever reason I need to still be able to compile this for now using iOS 6.1

Anyways, everything worked fine until I needed to use the didTapMyLocationButtonForMapView: method (which notifies me when the use clicks on the my location button) that seems to be only available in the latest google maps SDK which is version 1.7.2 (I couldn't find the method in the gmaps sdk shipped with the project so i simply replaced the old library with the latest one).

However, after doing that I started getting this compilation error:

Undefined symbols for architecture i386: "_glMapBufferRange", referenced from: gmscore::renderer::BufferObject::MapBuffer() in GoogleMaps(BufferObject.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Some claim on the web that this is because 1.7.2 is not compatible with iOS6. However, looking into the release notes of gmaps SDK.. I don't see any indication that 1.7.2 is not compatible with iOS 6 - notice how in the release note of version 1.5 they explicitly state

This release officially supports iOS 7, and requires iOS 6.0 or later (iOS 5.1 is no longer supported).

but no such disclaimer is found for iOS 6.

any idea what's going on here?

Was it helpful?

Solution

i did wind up making google maps 1.7.2 working with iOS 7 (i don't remember exactly how, but that's the easy part.. usually when get these undefined architecture problems.. i solve them by taking out support for the arm 64 and setting valid architectures only to no) but then that didn't address my problem b/c the didTapMyLocationButtonForMapView: method was a dud: it didn't work in google maps 1.7.2 (ie when the user did tap the my location button.. nothing happened).

note: so if the only reason why you are here is to verify if google maps 1.7.2 works with iOS7 i can tell you that it indeed does work. The rest of the this answer is about how to fire a callback when the mylocationButton is clicked without using the google maps 1.7.2 didTapMyLocationButtonForMapView: method, regardless if you are using 1.7.2 or prior versions.


so i reverted back to the older version of google sdk (i had no other reason to upgrade).. and created my own code that fires when the user taps the my location button. this is how it works (in a nutshell.. i override the UIApplication sendEvent method that gets fired whenever a user touches the screen, and capture the events that happen at the same dimension as the myLocation button.. and then go from there)

first I created a custom UIApplication class:

in main.m:

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv,  NSStringFromClass([TPMUApplication class]), NSStringFromClass([TPMUAppDelegate class]));

    }
}

TPMUApplication.h

@interface TPMUApplication : UIApplication

// the view controller that has the google maps in it
@property (nonatomic, strong) TPMUVC *VC;

@end

TPMUApplication.m

#import "TPMUApplication.h"
#import "TPMUVC.h"

@implementation TPMUApplication
- (void)sendEvent:(UIEvent *)event
{
    [super sendEvent:event];
    UIView *touchReceipientView =((UITouch *)[event.allTouches anyObject]).view;

    CGRect myLocationButtonFourchIncFrame = CGRectMake(256, 354, 64, 54);
    CGRect myLocationButtonThreeHalfIncFrame = CGRectMake(256, 266, 64, 54);

    if (CGRectEqualToRect(touchReceipientView.frame, myLocationButtonFourchIncFrame) ||
        CGRectEqualToRect(touchReceipientView.frame, myLocationButtonThreeHalfIncFrame)) {
        if (self.tVC.mapState != TPMUMapStateInMotionAsResultOfMyLocationButtonTap) {
            self.VC.mapState = TPMUMapStateInMotionAsResultOfMyLocationButtonTap;
            [self.VC didTapMyLocationButtonForMapView:self.VC.mapView];
        }
    }

}
@end

TPMUVC.h

#import <CoreLocation/CoreLocation.h>
#import <GoogleMaps/GoogleMaps.h>

typedef enum
{
    TPMUMapStateIdle = 0,
    TPMUMapStateInMotionAsResultOfUserGesture,
    TPMUMapStateInMotionAsResultOfMyLocationButtonTap
} TPMUMapState;


@interface TPMUVC : TPMUBaseViewController<GMSMapViewDelegate>

@property (nonatomic, strong) GMSMapView  *mapView;
@property (nonatomic, assign) TPMUMapState mapState;

- (BOOL)didTapMyLocationButtonForMapView:(GMSMapView *)mapView;

TPMUVC.m

#import "TPMUApplication.h"

@implementation TPMUVC

@synthesize mapView = mapView_;
@synthesize mapState = mapState_;

- (void)viewDidLoad
{
    TPMUApplication *tpmuApp = (TPMUApplication *)[UIApplication sharedApplication];
    tpmuApp.taxiRequestVC = self;
}


#pragma mark - GMSMapView delegate

- (void)mapView:(GMSMapView *)mapView willMove:(BOOL)gesture
{
    if (gesture) {
        mapState_ = TPMUMapStateInMotionAsResultOfUserGesture;
    }
}

- (void)mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position
{
    if (mapState_ == TPMUMapStateInMotionAsResultOfUserGesture) {
        mapState_ = TPMUMapStateIdle;

    }

    mapState_ = TPMUMapStateIdle;
    mapCameraPosition_ = position;
    DLog(@"map is now idle at position [lat: %f,long: %f] zoom: %f", position.target.latitude, position.target.longitude, position.zoom);
}

- (BOOL)didTapMyLocationButtonForMapView:(GMSMapView *)mapView {
    return YES;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top