diff --git a/gyp/certificates.gypi b/gyp/certificates.gypi index fdd818b8d..1d0c2acf8 100644 --- a/gyp/certificates.gypi +++ b/gyp/certificates.gypi @@ -4,7 +4,7 @@ 'type': 'none', 'hard_dependency': 1, 'copies': [{ - 'files': [ '../common/api_mapbox_com.der', '../common/ca-bundle.crt' ], + 'files': [ '../common/ca-bundle.crt' ], 'destination': '<(PRODUCT_DIR)' }], }, diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index e4b422fe8..90cddba45 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -649,8 +649,21 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { // Load Local Copy of Server's Public Key - // NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"b.ssl.fastly.net" ofType:@"der"]; - NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"api_mapbox_com" ofType:@"der"]; + NSString *cerPath = nil; + NSArray *bundles = [NSBundle allFrameworks]; + for (int lc = 0; lc < bundles.count; lc++) { + NSBundle *b = [bundles objectAtIndex:lc]; + cerPath = [[NSBundle mainBundle] pathForResource:@"api_mapbox_com" ofType:@"der"]; + if (cerPath != nil) { + break; + } + } + if (cerPath == nil) { + NSLog(@"cerPath not found."); + return; + } + +// NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"api_mapbox_com" ofType:@"der"]; NSData *localCertData = [NSData dataWithContentsOfFile:cerPath]; // Get Server's Public Key @@ -671,7 +684,6 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; } long numKeys = SecTrustGetCertificateCount(serverTrust); - NSLog(@"Number of certificaties presented: %ld", numKeys); BOOL found = false; for (int lc = 0; lc < numKeys; lc++) { diff --git a/common/api_mapbox_com.der b/platform/ios/resources/api_mapbox_com.der similarity index 100% rename from common/api_mapbox_com.der rename to platform/ios/resources/api_mapbox_com.der