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',
|
'../platform/ios/MGLAnnotationImage.m',
|
||||||
'../include/mbgl/ios/MGLStyle.h',
|
'../include/mbgl/ios/MGLStyle.h',
|
||||||
'../platform/ios/MGLStyle.mm',
|
'../platform/ios/MGLStyle.mm',
|
||||||
|
'../platform/ios/MGLCategoryLoader.h',
|
||||||
|
'../platform/ios/MGLCategoryLoader.m',
|
||||||
'../platform/ios/NSBundle+MGLAdditions.h',
|
'../platform/ios/NSBundle+MGLAdditions.h',
|
||||||
'../platform/ios/NSBundle+MGLAdditions.m',
|
'../platform/ios/NSBundle+MGLAdditions.m',
|
||||||
'../platform/ios/NSException+MGLAdditions.h',
|
'../platform/ios/NSException+MGLAdditions.h',
|
||||||
@@ -82,7 +84,6 @@
|
|||||||
'-framework MobileCoreServices',
|
'-framework MobileCoreServices',
|
||||||
'-framework QuartzCore',
|
'-framework QuartzCore',
|
||||||
'-framework SystemConfiguration',
|
'-framework SystemConfiguration',
|
||||||
'-ObjC',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#import "MGLAccountManager_Private.h"
|
#import "MGLAccountManager_Private.h"
|
||||||
#import "MGLMapboxEvents.h"
|
#import "MGLMapboxEvents.h"
|
||||||
|
#import "MGLCategoryLoader.h"
|
||||||
#import "NSProcessInfo+MGLAdditions.h"
|
#import "NSProcessInfo+MGLAdditions.h"
|
||||||
|
|
||||||
#import <Fabric/FABKitProtocol.h>
|
#import <Fabric/FABKitProtocol.h>
|
||||||
@@ -34,6 +35,8 @@
|
|||||||
// Can be called from any thread.
|
// Can be called from any thread.
|
||||||
//
|
//
|
||||||
+ (instancetype) sharedManager {
|
+ (instancetype) sharedManager {
|
||||||
|
[MGLCategoryLoader loadCategories];
|
||||||
|
|
||||||
if (NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) {
|
if (NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) {
|
||||||
return nil;
|
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
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
void mgl_linkBundleCategory();
|
||||||
|
|
||||||
@interface NSBundle (MGLAdditions)
|
@interface NSBundle (MGLAdditions)
|
||||||
|
|
||||||
+ (NSString *)mgl_resourceBundlePath;
|
+ (NSString *)mgl_resourceBundlePath;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
@implementation NSBundle (MGLAdditions)
|
@implementation NSBundle (MGLAdditions)
|
||||||
|
|
||||||
|
void mgl_linkBundleCategory(){}
|
||||||
|
|
||||||
+ (NSString *)mgl_resourceBundlePath
|
+ (NSString *)mgl_resourceBundlePath
|
||||||
{
|
{
|
||||||
NSString *resourceBundlePath = [[NSBundle bundleForClass:[MGLMapView class]] pathForResource:@"Mapbox" ofType:@"bundle"];
|
NSString *resourceBundlePath = [[NSBundle bundleForClass:[MGLMapView class]] pathForResource:@"Mapbox" ofType:@"bundle"];
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
void mgl_linkProcessCategory();
|
||||||
|
|
||||||
@interface NSProcessInfo (MGLAdditions)
|
@interface NSProcessInfo (MGLAdditions)
|
||||||
|
|
||||||
- (BOOL)mgl_isInterfaceBuilderDesignablesAgent;
|
- (BOOL)mgl_isInterfaceBuilderDesignablesAgent;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
@implementation NSProcessInfo (MGLAdditions)
|
@implementation NSProcessInfo (MGLAdditions)
|
||||||
|
|
||||||
|
void mgl_linkProcessCategory(){}
|
||||||
|
|
||||||
- (BOOL)mgl_isInterfaceBuilderDesignablesAgent
|
- (BOOL)mgl_isInterfaceBuilderDesignablesAgent
|
||||||
{
|
{
|
||||||
return [self.processName isEqualToString:@"IBDesignablesAgentCocoaTouch"];
|
return [self.processName isEqualToString:@"IBDesignablesAgentCocoaTouch"];
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
void mgl_linkStringCategory();
|
||||||
|
|
||||||
@interface NSString (MGLAdditions)
|
@interface NSString (MGLAdditions)
|
||||||
|
|
||||||
/** Returns the receiver if non-empty or nil if empty. */
|
/** Returns the receiver if non-empty or nil if empty. */
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
@implementation NSString (MGLAdditions)
|
@implementation NSString (MGLAdditions)
|
||||||
|
|
||||||
|
void mgl_linkStringCategory(){}
|
||||||
|
|
||||||
- (nullable NSString *)mgl_stringOrNilIfEmpty
|
- (nullable NSString *)mgl_stringOrNilIfEmpty
|
||||||
{
|
{
|
||||||
return self.length ? self : nil;
|
return self.length ? self : nil;
|
||||||
|
|||||||
Reference in New Issue
Block a user