I wanna build React Native iOS PhotoEditor module in Swift.
I simply created a new library using react-native-create-library and modified the iOS module like this.
For now, I just wanna push a simple UIViewController.
I followed Native Modules Guideline of React Native but I am getting error while launching the app.
I attached the screenshot of the structure, full codes and error logs.
// RNPhotoEditor.swift
// RNPhotoEditor
//
// Created by Gang on 2/13/19.
// Copyright © 2019 Facebook. All rights reserved.
//
import Foundation
import UIKit
#objc(RNPhotoEditor)
class RNPhotoEditor: NSObject {
#objc func Edit(props: NSDictionary, onDone: RCTResponseSenderBlock, onCancel: RCTResponseSenderBlock) -> Void {
let editorVC = PhotoEditorViewController()
getRootVC().present(editorVC, animated: true, completion: nil)
}
func getRootVC() -> UIViewController {
var root = UIApplication.shared.keyWindow?.rootViewController
while root?.presentedViewController != nil {
root = root?.presentedViewController
}
return root!
}
}
//
// RNPhotoEditorBridge.m
// RNPhotoEditor
//
// Created by Gang on 2/13/19.
// Copyright © 2019 Facebook. All rights reserved.
//
#import <React/RCTBridgeModule.h>
#interface RCT_EXTERN_MODULE(RNPhotoEditor, NSObject)
RCT_EXTERN_METHOD(Edit:(nonnull NSDictionary *)props onDone:(RCTResponseSenderBlock)onDone onCancel:(RCTResponseSenderBlock)onCancel)
#end
//
// RNPhotoEditor-Bridging-Header.h
// RNPhotoEditor-Bridging-Header
//
// Created by Gang on 2/13/19.
// Copyright © 2019 Facebook. All rights reserved.
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <React/RCTBridgeModule.h>
Here is the error log.
ld: warning: directory not found for option '-L/Users/gang/Library/Developer/Xcode/DerivedData/app-ezczldbbkpyqcxaeyxheyjdtqbth/Build/Products/Debug-iphoneos/React'
ld: warning: object file (/Users/gang/Library/Developer/Xcode/DerivedData/app-ezczldbbkpyqcxaeyxheyjdtqbth/Build/Products/Debug-iphoneos/libLRDRCTSimpleToast.a(UIView+Toast.o)) was built for newer iOS version (9.3) than being linked (9.0)
ld: warning: object file (/Users/gang/Library/Developer/Xcode/DerivedData/app-ezczldbbkpyqcxaeyxheyjdtqbth/Build/Products/Debug-iphoneos/libLRDRCTSimpleToast.a(LRDRCTSimpleToast.o)) was built for newer iOS version (9.3) than being linked (9.0)
ld: warning: Could not find auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find auto-linked library 'swiftFoundation'
ld: warning: Could not find auto-linked library 'swiftMetal'
ld: warning: Could not find auto-linked library 'swiftDarwin'
ld: warning: Could not find auto-linked library 'swiftUIKit'
ld: warning: Could not find auto-linked library 'swiftObjectiveC'
ld: warning: Could not find auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find auto-linked library 'swiftDispatch'
ld: warning: Could not find auto-linked library 'swiftCoreImage'
ld: warning: Could not find auto-linked library 'swiftQuartzCore'
ld: warning: Could not find auto-linked library 'swiftCore'
ld: warning: Could not find auto-linked library 'swiftSwiftOnoneSupport'
Undefined symbols for architecture arm64:
"value witness table for Builtin.UnknownObject", referenced from:
full type metadata for RNPhotoEditor.PhotoEditorViewController in libRNPhotoEditor.a(PhotoEditorViewController.o)
full type metadata for RNPhotoEditor.RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
"(extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString", referenced from:
RNPhotoEditor.PhotoEditorViewController.init(nibName: Swift.String?, bundle: __C.NSBundle?) -> RNPhotoEditor.PhotoEditorViewController in libRNPhotoEditor.a(PhotoEditorViewController.o)
"static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String", referenced from:
#objc RNPhotoEditor.PhotoEditorViewController.init(nibName: Swift.String?, bundle: __C.NSBundle?) -> RNPhotoEditor.PhotoEditorViewController in libRNPhotoEditor.a(PhotoEditorViewController.o)
"(extension in Foundation):Swift.Array._bridgeToObjectiveC() -> __C.NSArray", referenced from:
reabstraction thunk helper from #callee_unowned #convention(block) (#unowned __C.NSArray?) -> () to #escaping #callee_guaranteed (#guaranteed [Any]?) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"Swift._fatalErrorMessage(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never", referenced from:
RNPhotoEditor.RNPhotoEditor.getRootVC() -> __C.UIViewController in libRNPhotoEditor.a(RNPhotoEditor.o)
"type metadata for Any", referenced from:
reabstraction thunk helper from #callee_unowned #convention(block) (#unowned __C.NSArray?) -> () to #escaping #callee_guaranteed (#guaranteed [Any]?) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"__swift_FORCE_LOAD_$_swiftCoreFoundation", referenced from:
__swift_FORCE_LOAD_$_swiftCoreFoundation_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftCoreFoundation_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftCoreFoundation_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftCoreGraphics", referenced from:
__swift_FORCE_LOAD_$_swiftCoreGraphics_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftCoreGraphics_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftCoreGraphics_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftCoreImage", referenced from:
__swift_FORCE_LOAD_$_swiftCoreImage_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftCoreImage_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftCoreImage_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftDarwin", referenced from:
__swift_FORCE_LOAD_$_swiftDarwin_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftDarwin_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftDarwin_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftDispatch", referenced from:
__swift_FORCE_LOAD_$_swiftDispatch_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftDispatch_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftDispatch_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftFoundation", referenced from:
__swift_FORCE_LOAD_$_swiftFoundation_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftFoundation_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFoundation_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftMetal", referenced from:
__swift_FORCE_LOAD_$_swiftMetal_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftMetal_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftMetal_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftObjectiveC", referenced from:
__swift_FORCE_LOAD_$_swiftObjectiveC_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftObjectiveC_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftObjectiveC_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftQuartzCore", referenced from:
__swift_FORCE_LOAD_$_swiftQuartzCore_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftQuartzCore_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftQuartzCore_$_RNPhotoEditor)
"__swift_FORCE_LOAD_$_swiftUIKit", referenced from:
__swift_FORCE_LOAD_$_swiftUIKit_$_RNPhotoEditor in libRNPhotoEditor.a(PhotoEditorViewController.o)
__swift_FORCE_LOAD_$_swiftUIKit_$_RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftUIKit_$_RNPhotoEditor)
"_swift_allocObject", referenced from:
#objc RNPhotoEditor.RNPhotoEditor.Edit(props: __C.NSDictionary, onDone: ([Any]?) -> (), onCancel: ([Any]?) -> ()) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_bridgeObjectRelease", referenced from:
RNPhotoEditor.PhotoEditorViewController.init(nibName: Swift.String?, bundle: __C.NSBundle?) -> RNPhotoEditor.PhotoEditorViewController in libRNPhotoEditor.a(PhotoEditorViewController.o)
outlined consume of Swift.String? in libRNPhotoEditor.a(PhotoEditorViewController.o)
reabstraction thunk helper from #callee_unowned #convention(block) (#unowned __C.NSArray?) -> () to #escaping #callee_guaranteed (#guaranteed [Any]?) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_bridgeObjectRetain", referenced from:
outlined copy of Swift.String? in libRNPhotoEditor.a(PhotoEditorViewController.o)
reabstraction thunk helper from #callee_unowned #convention(block) (#unowned __C.NSArray?) -> () to #escaping #callee_guaranteed (#guaranteed [Any]?) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_deallocObject", referenced from:
l_objectdestroy in libRNPhotoEditor.a(RNPhotoEditor.o)
l_objectdestroy.2 in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_getInitializedObjCClass", referenced from:
type metadata accessor for RNPhotoEditor.PhotoEditorViewController in libRNPhotoEditor.a(PhotoEditorViewController.o)
RNPhotoEditor.RNPhotoEditor.getRootVC() -> __C.UIViewController in libRNPhotoEditor.a(RNPhotoEditor.o)
type metadata accessor for RNPhotoEditor.RNPhotoEditor in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_getObjCClassFromMetadata", referenced from:
__C.UIViewController.__allocating_init() -> __C.UIViewController in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_isaMask", referenced from:
RNPhotoEditor.RNPhotoEditor.Edit(props: __C.NSDictionary, onDone: ([Any]?) -> (), onCancel: ([Any]?) -> ()) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_release", referenced from:
#objc RNPhotoEditor.RNPhotoEditor.Edit(props: __C.NSDictionary, onDone: ([Any]?) -> (), onCancel: ([Any]?) -> ()) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
"_swift_retain", referenced from:
#objc RNPhotoEditor.RNPhotoEditor.Edit(props: __C.NSDictionary, onDone: ([Any]?) -> (), onCancel: ([Any]?) -> ()) -> () in libRNPhotoEditor.a(RNPhotoEditor.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am really not sure what the following error means.
ld: symbol(s) not found for architecture arm64
Also, how can I clear this kind of warnings?
ld: warning: Could not find auto-linked library 'swiftUIKit'
Can someone please tell me how to write Swift iOS library for React Native? I am struggling for a couple of days but no luck.
I'd appreciate any help! Thanks.
Related
I'm linking a CMake generated framework to an iOS test Bundle application, in order to execute the tests contained in the framework over an iOS platform.
When building, I have an very strange errors in the link stage:
ld: warning: directory not found for option '-L/Users/fporcarelli/GIT/iOSApp/iGeoMobile/smartsdk-middleware/smartsdk-core/Unit-Tests/iOS/SmartSDK-core-tester/../../build/NavNetwork/smartsdk-core/External/lib'
Undefined symbols for architecture x86_64:
"_strchr", referenced from:
_lprofFindFirstDirSeparator in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_open", referenced from:
_lprofOpenFileEx in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_uname", referenced from:
_lprofGetHostName in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_ftell", referenced from:
_getProfileFileSizeForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_strncpy", referenced from:
_createProfileDir in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofGetHostName in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_setenv", referenced from:
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_fwrite", referenced from:
_fileWriter in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_atexit", referenced from:
___llvm_profile_register_write_file_atexit in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
(maybe you meant: ___llvm_profile_register_write_file_atexit)
"_fopen", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_mmap", referenced from:
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_munmap", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_ftruncate", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_fseek", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_fileWriter in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_getProfileFileSizeForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_fprintf", referenced from:
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_getProfileFileSizeForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofOpenFileEx in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
...
"_strerror", referenced from:
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_getProfileFileSizeForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_fclose", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_free", referenced from:
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_instrument_target_value in libclang_rt.profile_iossim.a(InstrProfilingValue.c.o)
"_strcmp", referenced from:
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_fileno", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofLockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
_lprofUnlockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_fflush", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_exit", referenced from:
_exitSignalHandler in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_getenv", referenced from:
___llvm_profile_initialize_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofSetupValueProfiler in libclang_rt.profile_iossim.a(InstrProfilingValue.c.o)
"_calloc", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_instrument_target_value in libclang_rt.profile_iossim.a(InstrProfilingValue.c.o)
"_sigaction", referenced from:
_lprofInstallSignalHandler in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_strdup", referenced from:
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_memset", referenced from:
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeOneValueProfData in libclang_rt.profile_iossim.a(InstrProfilingWriter.c.o)
"_fdopen", referenced from:
_lprofOpenFileEx in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_atoi", referenced from:
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofSetupValueProfiler in libclang_rt.profile_iossim.a(InstrProfilingValue.c.o)
"___stderrp", referenced from:
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_getProfileFileSizeForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofOpenFileEx in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
...
"_snprintf", referenced from:
_getCurFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_strlen", referenced from:
_getCurFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_createProfileDir in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"_fcntl", referenced from:
_lprofLockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
_lprofUnlockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
_lprofOpenFileEx in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_mkdir", referenced from:
___llvm_profile_recursive_mkdir in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
(maybe you meant: ___llvm_profile_recursive_mkdir)
"___error", referenced from:
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_writeFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_getProfileFileSizeForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_mmapProfileForMerging in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofLockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
_lprofUnlockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
...
"_getpid", referenced from:
_getCurFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_parseAndSetFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofLockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
_lprofUnlockFileHandle in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
_lprofOpenFileEx in libclang_rt.profile_iossim.a(InstrProfilingUtil.c.o)
"_ftello", referenced from:
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
"__Unwind_Resume", referenced from:
-[SmartSDK_core_tests testALL] in SmartSDK_core_tests.o
"___stack_chk_guard", referenced from:
-[SmartSDK_core_tests testALL] in SmartSDK_core_tests.o
_getCurFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_createProfileDir in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofBufferIOWrite in libclang_rt.profile_iossim.a(InstrProfilingWriter.c.o)
...
"_memcpy", referenced from:
_getCurFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofBufferWriter in libclang_rt.profile_iossim.a(InstrProfilingWriter.c.o)
_lprofBufferIOWrite in libclang_rt.profile_iossim.a(InstrProfilingWriter.c.o)
"___stack_chk_fail", referenced from:
-[SmartSDK_core_tests testALL] in SmartSDK_core_tests.o
_getCurFilename in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
___llvm_profile_write_file in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_truncateCurrentFile in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_initializeProfileForContinuousMode in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_createProfileDir in libclang_rt.profile_iossim.a(InstrProfilingFile.c.o)
_lprofBufferIOWrite in libclang_rt.profile_iossim.a(InstrProfilingWriter.c.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The error is very strange, since the unresolved symbols do not belong to my code, but to clang-related static libraries...
Thanks in advance for any help
I found the issue. One of the CMake targets in my framework was named "System". So, the correspondent output file was a "libSystem.a" static library. Swift framework must link to every target an homonym library which contains all standard libraries. For some reasons, the linker found my library in place of the correct one, and so every framework was not able to find the symbols defined in standard libraries (since they are not defined in my System lib).
I am trying to run the following test from Chapter 16: Testing with RxTest of Raywenderlich RxSwift book:
import XCTest
import RxSwift
import RxTest
#testable import Testing
class TestingViewModel : XCTestCase {
var viewModel: ViewModel!
var scheduler: ConcurrentDispatchQueueScheduler!
override func setUp() {
super.setUp()
viewModel = ViewModel()
scheduler = ConcurrentDispatchQueueScheduler(qos: .default)
}
func testColorNameIsRayWenderlichGreenWhenHexStringIs006636() {
// 1
let colorNameObservable = viewModel.colorName.asObservable().subscribeOn(scheduler)
// 2
viewModel.hexString.value = "#006636"
// 3
XCTAssertEqual("rayWenderlichGreen", try! colorNameObservable.toBlocking().first()!)
}
}
But I get this error on the simulator:
Undefined symbols for architecture x86_64:
"type metadata for RxCocoa.DriverSharingStrategy", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"protocol witness table for RxCocoa.DriverSharingStrategy : RxCocoa.SharingStrategyProtocol in RxCocoa", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"RxCocoa.SharedSequence.asObservable() -> RxSwift.Observable", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And This one on iPhone 6s:
Undefined symbols for architecture arm64:
"type metadata for RxCocoa.DriverSharingStrategy", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"protocol witness table for RxCocoa.DriverSharingStrategy : RxCocoa.SharingStrategyProtocol in RxCocoa", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
"RxCocoa.SharedSequence.asObservable() -> RxSwift.Observable", referenced from:
TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Unfortunately, there is no support for this issue in Raywenderlich's forums.
After a lot of searches, As somebody suggests here for another similar issue I found that this error will be solved by importing RxCocoa.
After downloading Xcode 8 and migrating to Swift 3 I'm not longer able to archive the project. At the same time the project builds without any issues.
Error that I get:
Undefined symbols for architecture armv7:
"Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet :
(Swift.Int) -> A).(closure #1)", referenced from:
function signature specialization of generic specialization
with
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._siftDown (inout A,
index : A.Index, subRange : Swift.Range, by : inout
(A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> () in
OrderCoordinator.o
function signature specialization of generic specialization
with
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._heapSort (inout A,
subRange : Swift.Range, by : inout (A.Iterator.Element,
A.Iterator.Element) -> Swift.Bool) -> () in OrderCoordinator.o
function signature specialization of generic specialization
with
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._partition (inout A,
subRange : Swift.Range, by : inout (A.Iterator.Element,
A.Iterator.Element) -> Swift.Bool) -> A.Index in OrderCoordinator.o
ld: symbol(s) not found for architecture armv7 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I was able to get rid of error by commenting array sorting code in following function:
func didFinishWithResults(_ results: [PhotoProcessorResult]) {
guard let album = albumService.currentAlbum else { return }
//let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex })
let updateItems = zip(sortedResults, album.assetItems).map { (photoProcessorResult, assetItem) -> UpdateItem in
UpdateItem(path: photoProcessorResult.filePath, position: photoProcessorResult.fileIndex, isCover: assetItem.isCover)
}
albumService.updateAlbumWithItems(updateItems) { (success, errorDescription) in
if success {
self.handleAlbumUpdate()
} else {
self.showFailureAlert(errorDescription) {
self.startProcessingAlbum(self.albumService.currentAlbum)
}
}
}
}
While I resolved issue by sorting data using NSArray, I don't like this solution.
Will be grateful for any suggestions.
Since it compiles i don't think there is anything wrong with your code. The fact that it says "Undefined symbols for architecture armv7" and is failing to archive tells me that something is going on with your project, but unfortunately there are many ways to cause this problem. arm7 is iphone 5 so your project is probably setup correctly only for arm64. Try the solutions mentioned here: Undefined symbols for architecture armv7
If here is problem only for the this line:
let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex })
You can change to it:
let sortedResults = results.sorted { (first, second) -> Bool in
return first.fileIndex < second.fileIndex
}
Did it solve your problem?
Issue disappeared after updating to XCode 8.1.
Thanks everyone :)
I wish to unit test my Array extension.
extension Array {
func itemPassingTest(test: (T) -> Bool) -> T? {
for item in self {
if test(item) {
return item
}
}
return nil
}
}
In my unit test target, I have
import XCTest
import JLTExample
class JLTExampleTests: XCTestCase {
func testExtensionArray() {
let target = [ ["a" : 1], ["a" : 2], ["a" : 3] ]
let actual = target.itemPassingTest { $0["a"] == 2 }
XCTAssertNotNil(actual)
}
}
When building I get the error
Undefined symbols for architecture i386:
"__TFSa15itemPassingTestU__fGSaQ__FFQSbGSqQ_", referenced from:
__TFC17JLTExampleTests17JLTExampleTests18testExtensionArrayfS0_FT_T_ in JLTExampleTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My guess is I'm importing my extension, but I don't know how to import an extension. I was hoping that my extension would have been imported with the rest of my code in import JLTExample.
I'm trying to integrate Parse framework in my project built in iOS 7. I done in another project with iOS 6 and there wasn't any problem. With the new iOS, the project doesn't compile. It seems that the problem is Parsse framework isn't built for armv7s architecture. I don't know how to solve this problem.
I attach the problems that xcode 5 shows:
Undefined symbols for architecture armv7s: "_sqlite3_reset", referenced from:
_initializeStatement in Parse(PF_FBCacheIndex.o)
"_sqlite3_column_int", referenced from:
-[PF_FBCacheIndex _createCacheEntityInfo:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _fetchCurrentDiskUsage] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _trimDatabase] in Parse(PF_FBCacheIndex.o)
"_sqlite3_bind_int", referenced from:
-[PF_FBCacheIndex _updateEntryInDatabaseForKey:entry:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _writeEntryInDatabase:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _trimDatabase] in Parse(PF_FBCacheIndex.o)
"_sqlite3_column_text", referenced from:
-[PF_FBCacheIndex _createCacheEntityInfo:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _trimDatabase] in Parse(PF_FBCacheIndex.o)
"_sqlite3_bind_text", referenced from:
-[PF_FBCacheIndex _updateEntryInDatabaseForKey:entry:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _writeEntryInDatabase:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _readEntryFromDatabase:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _readEntriesFromDatabase:excludingFragment:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _removeEntryFromDatabaseForKey:] in Parse(PF_FBCacheIndex.o)
"_sqlite3_column_double", referenced from:
-[PF_FBCacheIndex _createCacheEntityInfo:] in Parse(PF_FBCacheIndex.o)
"_sqlite3_bind_double", referenced from:
-[PF_FBCacheIndex _updateEntryInDatabaseForKey:entry:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _writeEntryInDatabase:] in Parse(PF_FBCacheIndex.o)
"_sqlite3_step", referenced from:
-[PF_FBCacheIndex _updateEntryInDatabaseForKey:entry:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _writeEntryInDatabase:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _createCacheEntityInfo:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _fetchCurrentDiskUsage] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _removeEntryFromDatabaseForKey:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _dropTrimmingTable] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _trimDatabase] in Parse(PF_FBCacheIndex.o)
...
"_sqlite3_prepare_v2", referenced from:
_initializeStatement in Parse(PF_FBCacheIndex.o)
"_sqlite3_open_v2", referenced from:
___39-[PF_FBCacheIndex initWithCacheFolder:]_block_invoke in Parse(PF_FBCacheIndex.o)
"_sqlite3_errmsg", referenced from:
_releaseStatement in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _updateEntryInDatabaseForKey:entry:] in Parse(PF_FBCacheIndex.o)
_initializeStatement in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _writeEntryInDatabase:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _readEntryFromDatabase:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _readEntriesFromDatabase:excludingFragment:] in Parse(PF_FBCacheIndex.o)
-[PF_FBCacheIndex _fetchCurrentDiskUsage] in Parse(PF_FBCacheIndex.o)
...
"_sqlite3_finalize", referenced from:
_releaseStatement in Parse(PF_FBCacheIndex.o)
"_sqlite3_close", referenced from:
___26-[PF_FBCacheIndex dealloc]_block_invoke in Parse(PF_FBCacheIndex.o)
"_sqlite3_exec", referenced from:
___39-[PF_FBCacheIndex initWithCacheFolder:]_block_invoke in Parse(PF_FBCacheIndex.o)
ld: symbol(s) not found for architecture armv7s clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've solved the problem: what worked for me was to include the libraries:
libsqlite.3dylib
libz.dylib
They can be found in the Parse PushNotificationTutorial project. You can download it from the web of Parse.