Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] Removed alternative to -ObjC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
1ec5 committed Apr 17, 2016
1 parent 4175a09 commit 7a38e56
Show file tree
Hide file tree
Showing 16 changed files with 1 addition and 100 deletions.
10 changes: 0 additions & 10 deletions platform/darwin/src/MGLAccountManager.m
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -108,14 +106,6 @@ + (void)initializeIfNeeded {
} 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
Expand Down
2 changes: 0 additions & 2 deletions platform/darwin/src/NSBundle+MGLAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions platform/darwin/src/NSBundle+MGLAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#import "MGLAccountManager.h"

void mgl_linkBundleCategory() {}

@implementation NSBundle (MGLAdditions)

+ (instancetype)mgl_frameworkBundle {
Expand Down
2 changes: 0 additions & 2 deletions platform/darwin/src/NSProcessInfo+MGLAdditions.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#import <Foundation/Foundation.h>

void mgl_linkProcessInfoCategory();

@interface NSProcessInfo (MGLAdditions)

/**
Expand Down
2 changes: 0 additions & 2 deletions platform/darwin/src/NSProcessInfo+MGLAdditions.m
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions platform/darwin/src/NSString+MGLAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

NS_ASSUME_NONNULL_BEGIN

void mgl_linkStringCategory();

@interface NSString (MGLAdditions)

/** Returns the receiver if non-empty or nil if empty. */
Expand Down
2 changes: 0 additions & 2 deletions platform/darwin/src/NSString+MGLAdditions.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#import "NSString+MGLAdditions.h"

void mgl_linkStringCategory() {}

@implementation NSString (MGLAdditions)

- (nullable NSString *)mgl_stringOrNilIfEmpty
Expand Down
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 0 additions & 2 deletions platform/ios/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
2 changes: 0 additions & 2 deletions platform/ios/docs/pod-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 0 additions & 32 deletions platform/ios/framework/Mapbox.m

This file was deleted.

4 changes: 0 additions & 4 deletions platform/ios/ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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>"; };
Expand Down Expand Up @@ -465,7 +463,6 @@
isa = PBXGroup;
children = (
DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */,
DA88485F1CBAFC2E00AB86E3 /* Mapbox.m */,
DA8847DE1CBAFA3E00AB86E3 /* Foundation */,
DA8848331CBAFB2A00AB86E3 /* Kit */,
DA8848621CBAFCC100AB86E3 /* Resources */,
Expand Down Expand Up @@ -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 */,
Expand Down
1 change: 0 additions & 1 deletion platform/osx/platform.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
],

'sources': [
'sdk/Mapbox.m',
'../darwin/src/NSException+MGLAdditions.h',
'../darwin/src/NSString+MGLAdditions.h',
'../darwin/src/NSString+MGLAdditions.m',
Expand Down
33 changes: 0 additions & 33 deletions platform/osx/sdk/Mapbox.m

This file was deleted.

2 changes: 0 additions & 2 deletions platform/osx/src/MGLMapView+IBAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#import "MGLMapView_Private.h"

void mgl_linkMapViewIBCategory() {}

@implementation MGLMapView (IBAdditions)

+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyleURL__ {
Expand Down
2 changes: 0 additions & 2 deletions platform/osx/src/MGLMapView_Private.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7a38e56

Please sign in to comment.