2017-01-30 203 views
1

當再現步步這個this original exampleRCTMapboxGL (5.1.0)我碰上與鏈接錯誤。這發生在我身上我每次嘗試使用RCTMapboxGL時間。陣營,本機Mapbox-GL無法鏈接

我試用過:

Xcode的控制檯:

Duplicate definition

Xcode的控制檯:

Undefined symbols for architecture arm64: 
    "_OBJC_CLASS_$_RCTMapboxAnnotation", referenced from: 
     objc-class-ref in libRCTMapboxGL.a(RCTMapboxGL.o) 
ld: symbol(s) not found for architecture arm64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

丟失的符號RCTMapboxAnnotation../node_modules/react-native-mapbox-gl/ios/RCTMapboxGL.xcodeproj,它已添加到我的項目作爲參考。

RCTMapboxAnnotation

在Xcode其它鏈接器標記構建設置

Other Linker Flags in Xcode Build Settings

回答

1

我的解決辦法固定所有陣營橫跨MapboxGL庫導入語句。

把他們變成全球進口的形式#import <React/MissingClass.h>解決了這個問題:

例如#import RCTView.h#import <React/RCTView.h>

(9個文件總數):

RCTMapboxAnnotation.m

#import "RCTMapboxAnnotation.h" 
#import <React/RCTEventDispatcher.h> 
#import <React/UIView+React.h> 
#import <React/RCTBridge.h> 
#import <React/RCTUtils.h> 

RCTMapboxAnnotation.h

#import "RCTMapboxAnnotation.h" 
#import <MapBox/MapBox.h> 
#import <UIKit/UIKit.h> 
#import <React/RCTConvert+MapKit.h> 
#import <React/RCTComponent.h> 
#import "RCTMapboxGL.h" 

RCTMapboxAnnotationManager.m

#import "RCTMapboxAnnotationManager.h" 
#import <React/RCTUIManager.h> 
#import <React/RCTConvert+CoreLocation.h> 
#import <React/UIView+React.h> 
#import "RCTMapboxAnnotation.h" 

RCTMapboxAnnotationManager.h

#import <React/RCTViewManager.h> 

RCTMapboxGL.h

#import <Mapbox/Mapbox.h> 
#import <React/RCTView.h> 
#import <React/RCTEventDispatcher.h> 
#import <React/RCTBridgeModule.h> 

RCTMapboxGL.m

#import "RCTMapboxGL.h" 
#import <React/RCTBridgeModule.h> 
#import <React/RCTEventDispatcher.h> 
#import <React/UIView+React.h> 
#import <React/RCTLog.h> 
#import "RCTMapboxGLConversions.h" 
#import "RCTMapboxAnnotation.h" 

RCTMapboxGLManager.h

#import <React/RCTViewManager.h> 

RCTMapboxGLManager.m

#import "RCTMapboxGLManager.h" 
#import "RCTMapboxGL.h" 
#import <Mapbox/Mapbox.h> 
#import <React/RCTConvert+CoreLocation.h> 
#import <React/RCTConvert+MapKit.h> 
#import <React/RCTBridge.h> 
#import <React/RCTEventDispatcher.h> 
#import <React/UIView+React.h> 
#import <React/RCTUIManager.h> 
#import "RCTMapboxGLConversions.h" 
#import "MGLPolygon+RCTAdditions.h" 
#import "MGLPolyline+RCTAdditions.h" 

RCTMapboxGLConversions.m

#import <Foundation/Foundation.h> 
#import <React/RCTConvert+CoreLocation.h> 
#import <React/RCTConvert+MapKit.h> 
#import "RCTMapboxGL.h" 
+0

這與固定在這個混帳問題註釋的參考鏈接框架搜索路徑爲我工作一起:https://github.com/mapbox/反應母語-mapbox-GL /問題/ 297#issuecomment-247644647 – KinGBin