将cordova文件插件添加到现有ios项目时重复符号_kCDVFilesystemURLPrefix
Posted
技术标签:
【中文标题】将cordova文件插件添加到现有ios项目时重复符号_kCDVFilesystemURLPrefix【英文标题】:duplicate symbol _kCDVFilesystemURLPrefix when adding cordova file plugin to existing ios project 【发布时间】:2015-06-17 04:24:08 【问题描述】:我有一个现有的 ios 项目,我想使用 cordova web 视图(带有插件)。我已经按照 phonegap 文档中的instructions 进行了操作,并且我的项目成功编译。
但是,当我想将文件插件添加到我的项目时,我收到以下错误:
Ld /Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphonesimulator/appworks-ios.app/appworks-ios normal i386
cd /Users/jibrahim/workspace/appworks-ios
export IPHONEOS_DEPLOYMENT_TARGET=8.3
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -L/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphonesimulator -L/Users/jibrahim/workspace/appworks-ios/Pods/GGLInstanceID/Libraries -L/Users/jibrahim/workspace/appworks-ios/Pods/Google/Libraries -L/Users/jibrahim/workspace/appworks-ios/Pods/GoogleCloudMessaging/Libraries -L/Users/jibrahim/workspace/appworks-ios/Pods/GoogleInterchangeUtilities/Libraries -L/Users/jibrahim/workspace/appworks-ios/Pods/GoogleNetworkingUtilities/Libraries -L/Users/jibrahim/workspace/appworks-ios/Pods/GoogleSymbolUtilities/Libraries -L/Users/jibrahim/workspace/appworks-ios/Pods/GoogleUtilities/Libraries -L/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphoneos -F/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/appworks-ios.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lGGLCloudMessaging -lGGLCore -lGGLInstanceIDLib -lGSDK_Overload -lGTMSessionFetcher_core -lGTMSessionFetcher_full -lGTMStackTrace -lGTM_AddressBook -lGTM_DebugUtils -lGTM_GTMURLBuilder -lGTM_KVO -lGTM_NSDictionary+URLArguments -lGTM_NSScannerJSON -lGTM_NSStringhtml -lGTM_NSStringXML -lGTM_Regex -lGTM_RoundedRectPath -lGTM_StringEncoding -lGTM_SystemVersion -lGTM_UIFont+LineHeight -lGTM_core -lGTM_iPhone -lGcmLib -lPods-AFNetworking -lPods-CocoaLumberjack -lPods-ZipArchive -lProtocolBuffers -lsqlite3 -lz -framework AddressBook -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -ObjC -lGGLCloudMessaging -lGGLCore -lGGLInstanceIDLib -lGSDK_Overload -lGTMSessionFetcher_core -lGTMSessionFetcher_full -lGTMStackTrace -lGTM_AddressBook -lGTM_DebugUtils -lGTM_GTMURLBuilder -lGTM_KVO -lGTM_NSDictionary+URLArguments -lGTM_NSScannerJSON -lGTM_NSStringHTML -lGTM_NSStringXML -lGTM_Regex -lGTM_RoundedRectPath -lGTM_StringEncoding -lGTM_SystemVersion -lGTM_UIFont+LineHeight -lGTM_core -lGTM_iPhone -lGcmLib -lPods-AFNetworking -lPods-CocoaLumberjack -lPods-ZipArchive -lProtocolBuffers -lsqlite3 -lz -framework AddressBook -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.3 /Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphonesimulator/libCordova.a -framework AddressBook -framework AddressBookUI -framework AudioToolbox -framework AVFoundation -framework CoreLocation -framework CoreMedia -framework MediaPlayer -framework MobileCoreServices -framework QuartzCore -framework SystemConfiguration -framework CoreGraphics -lPods -framework AssetsLibrary -Xlinker -dependency_info -Xlinker /Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/appworks-ios_dependency_info.dat -o /Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphonesimulator/appworks-ios.app/appworks-ios
ld: warning: directory not found for option '-L/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Products/Debug-iphoneos'
duplicate symbol _kCDVFilesystemURLPrefix in:
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVFile.o
duplicate symbol _kCDVAssetsLibraryPrefix in:
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVFile.o
duplicate symbol _kCDVFilesystemURLPrefix in:
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVLocalFilesystem.o
duplicate symbol _kCDVAssetsLibraryPrefix in:
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVAssetLibraryFilesystem.o
/Users/jibrahim/Library/Developer/Xcode/DerivedData/appworks-ios-bvhgmyzzslupqsbrfkdduticdqik/Build/Intermediates/appworks-ios.build/Debug-iphonesimulator/appworks-ios.build/Objects-normal/i386/CDVLocalFilesystem.o
ld: 4 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
但奇怪的是,我添加的所有其他插件都能成功编译(例如 CDVSplashScreen)。仅当我将 CDVFile.m、CDVLocalFilesystem.m 和 CDVAssetLibraryFilesystem.m 添加到我的项目时,才会出现此问题。
任何帮助将不胜感激。
【问题讨论】:
【参考方案1】:在 XCode 中单击您的项目导航器。
从中单击 BuildSettings。
在其中找到No Common Blocks并设置为No。
它对我有用。
【讨论】:
用 XCode 8 为我解决了同样的问题,Cordova 由 Ionic Framework 管理(cli 2,项目在 Ionic 1 上)。 也为我工作 - XCode 12. iOS 14.【参考方案2】:最近出现了同样的问题,即使使用 cocoaPods
在 CDVFile.h 中解决
改变
NSString* const kCDVFilesystemURLPrefix;
到
extern NSString* const kCDVFilesystemURLPrefix;
【讨论】:
【参考方案3】:我不知道你是如何解决的,但我遇到了同样的问题并通过简单地用@“cdvfile”替换每个出现的问题来解决它。
【讨论】:
以上是关于将cordova文件插件添加到现有ios项目时重复符号_kCDVFilesystemURLPrefix的主要内容,如果未能解决你的问题,请参考以下文章