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;
}