refs #2966: remove -ObjC linker flag & bring in categories via other means
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
'../platform/ios/MGLAnnotationImage.m',
|
||||
'../include/mbgl/ios/MGLStyle.h',
|
||||
'../platform/ios/MGLStyle.mm',
|
||||
'../platform/ios/MGLCategoryLoader.h',
|
||||
'../platform/ios/MGLCategoryLoader.m',
|
||||
'../platform/ios/NSBundle+MGLAdditions.h',
|
||||
'../platform/ios/NSBundle+MGLAdditions.m',
|
||||
'../platform/ios/NSException+MGLAdditions.h',
|
||||
@@ -82,7 +84,6 @@
|
||||
'-framework MobileCoreServices',
|
||||
'-framework QuartzCore',
|
||||
'-framework SystemConfiguration',
|
||||
'-ObjC',
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#import "MGLAccountManager_Private.h"
|
||||
#import "MGLMapboxEvents.h"
|
||||
#import "MGLCategoryLoader.h"
|
||||
#import "NSProcessInfo+MGLAdditions.h"
|
||||
|
||||
#import <Fabric/FABKitProtocol.h>
|
||||
@@ -34,6 +35,8 @@
|
||||
// Can be called from any thread.
|
||||
//
|
||||
+ (instancetype) sharedManager {
|
||||
[MGLCategoryLoader loadCategories];
|
||||
|
||||
if (NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
7
platform/ios/MGLCategoryLoader.h
Normal file
7
platform/ios/MGLCategoryLoader.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MGLCategoryLoader : NSObject
|
||||
|
||||
+ (void)loadCategories;
|
||||
|
||||
@end
|
||||
18
platform/ios/MGLCategoryLoader.m
Normal file
18
platform/ios/MGLCategoryLoader.m
Normal file
@@ -0,0 +1,18 @@
|
||||
#import "MGLCategoryLoader.h"
|
||||
|
||||
#import "NSBundle+MGLAdditions.h"
|
||||
#import "NSProcessInfo+MGLAdditions.h"
|
||||
#import "NSString+MGLAdditions.h"
|
||||
|
||||
// https://github.com/mapbox/mapbox-gl-native/issues/2966
|
||||
|
||||
@implementation MGLCategoryLoader
|
||||
|
||||
+ (void)loadCategories
|
||||
{
|
||||
mgl_linkBundleCategory();
|
||||
mgl_linkProcessCategory();
|
||||
mgl_linkStringCategory();
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
void mgl_linkBundleCategory();
|
||||
|
||||
@interface NSBundle (MGLAdditions)
|
||||
|
||||
+ (NSString *)mgl_resourceBundlePath;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
@implementation NSBundle (MGLAdditions)
|
||||
|
||||
void mgl_linkBundleCategory(){}
|
||||
|
||||
+ (NSString *)mgl_resourceBundlePath
|
||||
{
|
||||
NSString *resourceBundlePath = [[NSBundle bundleForClass:[MGLMapView class]] pathForResource:@"Mapbox" ofType:@"bundle"];
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
void mgl_linkProcessCategory();
|
||||
|
||||
@interface NSProcessInfo (MGLAdditions)
|
||||
|
||||
- (BOOL)mgl_isInterfaceBuilderDesignablesAgent;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
@implementation NSProcessInfo (MGLAdditions)
|
||||
|
||||
void mgl_linkProcessCategory(){}
|
||||
|
||||
- (BOOL)mgl_isInterfaceBuilderDesignablesAgent
|
||||
{
|
||||
return [self.processName isEqualToString:@"IBDesignablesAgentCocoaTouch"];
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
void mgl_linkStringCategory();
|
||||
|
||||
@interface NSString (MGLAdditions)
|
||||
|
||||
/** Returns the receiver if non-empty or nil if empty. */
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
@implementation NSString (MGLAdditions)
|
||||
|
||||
void mgl_linkStringCategory(){}
|
||||
|
||||
- (nullable NSString *)mgl_stringOrNilIfEmpty
|
||||
{
|
||||
return self.length ? self : nil;
|
||||
|
||||
Reference in New Issue
Block a user