summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-14 09:52:04 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-04-16 22:46:23 -0700
commit7a38e568191a68e3311d36296e14c105b12c051c (patch)
tree759c6ad61fbc1202e3d914610792da48dd267711
parent4175a09b4bc931004c6f5706eb3ca9b2003cecac (diff)
downloadqtlocation-mapboxgl-7a38e568191a68e3311d36296e14c105b12c051c.tar.gz
[ios] Removed alternative to -ObjC
Xcode’s static library template comes with the -ObjC linker flag by default. Instead of removing that flag, this change removes the various imperfect workarounds we’ve been using to ensure that private SDK categories link. Given the size decrease in this static library since #2966 was fixed, we should have room to spare for the more straightforward approach. Moreover, an application that uses MGLMapView in a storyboard no longer needs to add -ObjC to the application target, which bloated the entire application, including other frameworks that had no need for -ObjC. -ObjC isn’t even needed for dynamic frameworks, and the OS X SDK is only built as a dynamic framework.
-rw-r--r--platform/darwin/src/MGLAccountManager.m10
-rw-r--r--platform/darwin/src/NSBundle+MGLAdditions.h2
-rw-r--r--platform/darwin/src/NSBundle+MGLAdditions.m2
-rw-r--r--platform/darwin/src/NSProcessInfo+MGLAdditions.h2
-rw-r--r--platform/darwin/src/NSProcessInfo+MGLAdditions.m2
-rw-r--r--platform/darwin/src/NSString+MGLAdditions.h2
-rw-r--r--platform/darwin/src/NSString+MGLAdditions.m2
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/INSTALL.md2
-rw-r--r--platform/ios/docs/pod-README.md2
-rw-r--r--platform/ios/framework/Mapbox.m32
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj4
-rw-r--r--platform/osx/platform.gyp1
-rw-r--r--platform/osx/sdk/Mapbox.m33
-rw-r--r--platform/osx/src/MGLMapView+IBAdditions.m2
-rw-r--r--platform/osx/src/MGLMapView_Private.h2
16 files changed, 1 insertions, 100 deletions
diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m
index bfaf9faae9..31baf4e249 100644
--- a/platform/darwin/src/MGLAccountManager.m
+++ b/platform/darwin/src/MGLAccountManager.m
@@ -1,8 +1,6 @@
#import "MGLAccountManager_Private.h"
-#import "MGLMapView.h"
#import "NSBundle+MGLAdditions.h"
#import "NSProcessInfo+MGLAdditions.h"
-#import "NSString+MGLAdditions.h"
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
#import "MGLMapboxEvents.h"
@@ -108,14 +106,6 @@
} else {
NSLog(@"MGLAccountManager is used in a project that doesn’t have Fabric.");
}
-
- // https://github.com/mapbox/mapbox-gl-native/issues/2966
- mgl_linkBundleCategory();
- mgl_linkStringCategory();
- mgl_linkProcessInfoCategory();
-
- // https://github.com/mapbox/mapbox-gl-native/issues/3113
- [MGLMapView class];
}
#endif
diff --git a/platform/darwin/src/NSBundle+MGLAdditions.h b/platform/darwin/src/NSBundle+MGLAdditions.h
index 52ef7fbfa7..8a3e5c3c2e 100644
--- a/platform/darwin/src/NSBundle+MGLAdditions.h
+++ b/platform/darwin/src/NSBundle+MGLAdditions.h
@@ -4,8 +4,6 @@
NS_ASSUME_NONNULL_BEGIN
-void mgl_linkBundleCategory();
-
@interface NSBundle (MGLAdditions)
/// Returns the bundle containing the SDK’s classes and Info.plist file.
diff --git a/platform/darwin/src/NSBundle+MGLAdditions.m b/platform/darwin/src/NSBundle+MGLAdditions.m
index e1f3e7c720..76d9cc0db7 100644
--- a/platform/darwin/src/NSBundle+MGLAdditions.m
+++ b/platform/darwin/src/NSBundle+MGLAdditions.m
@@ -2,8 +2,6 @@
#import "MGLAccountManager.h"
-void mgl_linkBundleCategory() {}
-
@implementation NSBundle (MGLAdditions)
+ (instancetype)mgl_frameworkBundle {
diff --git a/platform/darwin/src/NSProcessInfo+MGLAdditions.h b/platform/darwin/src/NSProcessInfo+MGLAdditions.h
index ea231d4e6a..1dc1439d53 100644
--- a/platform/darwin/src/NSProcessInfo+MGLAdditions.h
+++ b/platform/darwin/src/NSProcessInfo+MGLAdditions.h
@@ -1,7 +1,5 @@
#import <Foundation/Foundation.h>
-void mgl_linkProcessInfoCategory();
-
@interface NSProcessInfo (MGLAdditions)
/**
diff --git a/platform/darwin/src/NSProcessInfo+MGLAdditions.m b/platform/darwin/src/NSProcessInfo+MGLAdditions.m
index 3da2bf73ed..293f49538b 100644
--- a/platform/darwin/src/NSProcessInfo+MGLAdditions.m
+++ b/platform/darwin/src/NSProcessInfo+MGLAdditions.m
@@ -1,7 +1,5 @@
#import "NSProcessInfo+MGLAdditions.h"
-void mgl_linkProcessInfoCategory() {}
-
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
static NSString * const MGLIBDesignablesAgentProcessName = @"IBDesignablesAgentCocoaTouch";
#elif TARGET_OS_MAC
diff --git a/platform/darwin/src/NSString+MGLAdditions.h b/platform/darwin/src/NSString+MGLAdditions.h
index 6064f8b40f..3001624d32 100644
--- a/platform/darwin/src/NSString+MGLAdditions.h
+++ b/platform/darwin/src/NSString+MGLAdditions.h
@@ -4,8 +4,6 @@
NS_ASSUME_NONNULL_BEGIN
-void mgl_linkStringCategory();
-
@interface NSString (MGLAdditions)
/** Returns the receiver if non-empty or nil if empty. */
diff --git a/platform/darwin/src/NSString+MGLAdditions.m b/platform/darwin/src/NSString+MGLAdditions.m
index b94a5f0198..969886651b 100644
--- a/platform/darwin/src/NSString+MGLAdditions.m
+++ b/platform/darwin/src/NSString+MGLAdditions.m
@@ -1,7 +1,5 @@
#import "NSString+MGLAdditions.h"
-void mgl_linkStringCategory() {}
-
@implementation NSString (MGLAdditions)
- (nullable NSString *)mgl_stringOrNilIfEmpty
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 8541fc296d..d450401b94 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -4,6 +4,7 @@ Mapbox welcomes participation and contributions from everyone. If you’d like
## master
+- Applications linking against the SDK static framework no longer need to add `-ObjC` to the Other Linker Flags (`OTHER_LDFLAGS`) build setting. If you previously added this flag solely for this SDK, removing the flag may potentially reduce the overall size of your application. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
- User location heading updates now resume properly when an app becomes active again. ([#4674](https://github.com/mapbox/mapbox-gl-native/pull/4674))
- Removed unused SVG files from the SDK’s resource bundle. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md
index 4c769cedc4..b3ead6d0d6 100644
--- a/platform/ios/INSTALL.md
+++ b/platform/ios/INSTALL.md
@@ -123,8 +123,6 @@ If your application targets iOS 7.x, you’ll need to install the static framewo
- `libsqlite3.tbd`
- `libz.tbd`
-1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting.
-
### Use
1. Mapbox vector tiles require a Mapbox account and API access token. In the project editor, select the application target. In the Info tab, set `MGLMapboxAccessToken` to your access token. You can obtain one from the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/).
diff --git a/platform/ios/docs/pod-README.md b/platform/ios/docs/pod-README.md
index d62e23b606..9ed62c5610 100644
--- a/platform/ios/docs/pod-README.md
+++ b/platform/ios/docs/pod-README.md
@@ -54,8 +54,6 @@ If your application targets iOS 7.x, you’ll need to install the static framewo
- `libsqlite3.tbd`
- `libz.tbd`
-1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting.
-
{{/STATIC}}
## Configuration
diff --git a/platform/ios/framework/Mapbox.m b/platform/ios/framework/Mapbox.m
deleted file mode 100644
index a3f7b8e754..0000000000
--- a/platform/ios/framework/Mapbox.m
+++ /dev/null
@@ -1,32 +0,0 @@
-#import <Mapbox/Mapbox.h>
-
-#import "NSBundle+MGLAdditions.h"
-#import "NSProcessInfo+MGLAdditions.h"
-#import "NSString+MGLAdditions.h"
-
-__attribute__((constructor))
-static void InitializeMapbox() {
- static int initialized = 0;
- if (initialized) {
- return;
- }
-
- mgl_linkBundleCategory();
- mgl_linkStringCategory();
- mgl_linkProcessInfoCategory();
-
- [MGLAccountManager class];
- [MGLAnnotationImage class];
- [MGLMapCamera class];
- [MGLMapView class];
- [MGLMultiPoint class];
- [MGLOfflinePack class];
- [MGLOfflineStorage class];
- [MGLPointAnnotation class];
- [MGLPolygon class];
- [MGLPolyline class];
- [MGLShape class];
- [MGLStyle class];
- [MGLTilePyramidOfflineRegion class];
- [MGLUserLocation class];
-}
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 3260c2ccc5..0173e8f6bf 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -87,7 +87,6 @@
DA88485C1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.h in Headers */ = {isa = PBXBuildFile; fileRef = DA88484D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.h */; };
DA88485D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88484E1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m */; };
DA8848601CBAFC2E00AB86E3 /* Mapbox.h in Headers */ = {isa = PBXBuildFile; fileRef = DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */; settings = {ATTRIBUTES = (Public, ); }; };
- DA8848611CBAFC2E00AB86E3 /* Mapbox.m in Sources */ = {isa = PBXBuildFile; fileRef = DA88485F1CBAFC2E00AB86E3 /* Mapbox.m */; };
DA88486D1CBAFCC100AB86E3 /* Compass.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848631CBAFCC100AB86E3 /* Compass.png */; };
DA88486E1CBAFCC100AB86E3 /* Compass@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848641CBAFCC100AB86E3 /* Compass@2x.png */; };
DA88486F1CBAFCC100AB86E3 /* Compass@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848651CBAFCC100AB86E3 /* Compass@3x.png */; };
@@ -310,7 +309,6 @@
DA88484D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLUserLocationAnnotationView.h; path = src/MGLUserLocationAnnotationView.h; sourceTree = "<group>"; };
DA88484E1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLUserLocationAnnotationView.m; path = src/MGLUserLocationAnnotationView.m; sourceTree = "<group>"; };
DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mapbox.h; sourceTree = "<group>"; };
- DA88485F1CBAFC2E00AB86E3 /* Mapbox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Mapbox.m; sourceTree = "<group>"; };
DA8848631CBAFCC100AB86E3 /* Compass.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Compass.png; sourceTree = "<group>"; };
DA8848641CBAFCC100AB86E3 /* Compass@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Compass@2x.png"; sourceTree = "<group>"; };
DA8848651CBAFCC100AB86E3 /* Compass@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Compass@3x.png"; sourceTree = "<group>"; };
@@ -465,7 +463,6 @@
isa = PBXGroup;
children = (
DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */,
- DA88485F1CBAFC2E00AB86E3 /* Mapbox.m */,
DA8847DE1CBAFA3E00AB86E3 /* Foundation */,
DA8848331CBAFB2A00AB86E3 /* Kit */,
DA8848621CBAFCC100AB86E3 /* Resources */,
@@ -922,7 +919,6 @@
DA8848901CBB048E00AB86E3 /* reachability.m in Sources */,
DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */,
DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */,
- DA8848611CBAFC2E00AB86E3 /* Mapbox.m in Sources */,
DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */,
DA8848281CBAFA6200AB86E3 /* MGLShape.m in Sources */,
DA8848321CBAFA6200AB86E3 /* NSString+MGLAdditions.m in Sources */,
diff --git a/platform/osx/platform.gyp b/platform/osx/platform.gyp
index 229c721845..b5b12b70c1 100644
--- a/platform/osx/platform.gyp
+++ b/platform/osx/platform.gyp
@@ -143,7 +143,6 @@
],
'sources': [
- 'sdk/Mapbox.m',
'../darwin/src/NSException+MGLAdditions.h',
'../darwin/src/NSString+MGLAdditions.h',
'../darwin/src/NSString+MGLAdditions.m',
diff --git a/platform/osx/sdk/Mapbox.m b/platform/osx/sdk/Mapbox.m
deleted file mode 100644
index dc935cd265..0000000000
--- a/platform/osx/sdk/Mapbox.m
+++ /dev/null
@@ -1,33 +0,0 @@
-#import <Mapbox/Mapbox.h>
-
-#import "../src/MGLMapView_Private.h"
-#import "../../darwin/src/NSBundle+MGLAdditions.h"
-#import "../../darwin/src/NSProcessInfo+MGLAdditions.h"
-#import "../../darwin/src/NSString+MGLAdditions.h"
-
-__attribute__((constructor))
-static void InitializeMapbox() {
- static int initialized = 0;
- if (initialized) {
- return;
- }
-
- mgl_linkBundleCategory();
- mgl_linkStringCategory();
- mgl_linkProcessInfoCategory();
- mgl_linkMapViewIBCategory();
-
- [MGLAccountManager class];
- [MGLAnnotationImage class];
- [MGLMapCamera class];
- [MGLMapView class];
- [MGLMultiPoint class];
- [MGLOfflinePack class];
- [MGLOfflineStorage class];
- [MGLPointAnnotation class];
- [MGLPolygon class];
- [MGLPolyline class];
- [MGLShape class];
- [MGLStyle class];
- [MGLTilePyramidOfflineRegion class];
-}
diff --git a/platform/osx/src/MGLMapView+IBAdditions.m b/platform/osx/src/MGLMapView+IBAdditions.m
index da18760645..eada47ef90 100644
--- a/platform/osx/src/MGLMapView+IBAdditions.m
+++ b/platform/osx/src/MGLMapView+IBAdditions.m
@@ -2,8 +2,6 @@
#import "MGLMapView_Private.h"
-void mgl_linkMapViewIBCategory() {}
-
@implementation MGLMapView (IBAdditions)
+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ {
diff --git a/platform/osx/src/MGLMapView_Private.h b/platform/osx/src/MGLMapView_Private.h
index b9a112718e..76b1727925 100644
--- a/platform/osx/src/MGLMapView_Private.h
+++ b/platform/osx/src/MGLMapView_Private.h
@@ -1,7 +1,5 @@
#import "MGLMapView.h"
-void mgl_linkMapViewIBCategory();
-
@interface MGLMapView (Private)
/// True if the view or application is in a state where it is not expected to be