I am getting this error when running a library I created in a third-party project on iOS 5. The project compiles just fine but right upon startup I get the following in my console:
dyld: Symbol not found: _NSFontAttributeName
Referenced from: /Users/Stunner/Library/Application Support/iPhone Simulator/5.0/Applications/C26FFA60-BB4A-4321-908A-0EF8756F47D3/An.app/An
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit
in /Users/Stunner/Library/Application Support/iPhone Simulator/5.0/Applications/C26FFA60-BB4A-4321-908A-0EF8756F47D3/An.app/An
What perplexes me is that I have a sample app for the library I created, and when run on iOS 5, it runs fine. I am suspecting that there may be additional build settings in the third-party application that is causing me to see this error.
In my sample app I have the following linker flag:
-ObjC
The third party app has these:
-ObjC -lxml2 -lz -all_load
Related
My app was running perfectly without any errors or warnings yesterday. But when I tried to run it today, the build failed - I haven't changed anything in the code:
Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport
How to fix this, and why would something like this occur suddenly when it was working before?
And this is an issue I've been experiencing with XCode a lot lately. My code will be running smoothly without any errors, but then XCode will randomly start throwing errors when I relaunch it at a different time - without making any changes in the actual code.
I have included some photos and the full text of those photos:
InventoryApp 3 issues
Warning
Could not find or use auto-linked library 'XCTestSwiftSupport'
Could not find or use auto linked framework 'XCTest'
Error
Undefined symbol: __swift FORCE LOAD $ XCTestSwiftSupport
ld: warning: Could not find or use auto-linked library 'XCTestSwiftSupport'
ld: warning: Could not find or use auto-linked framework
'XCTest'
Undefined symbols for architecture arm64:
"__swift_FORCE_LOAD_$_XCTestSwiftSupport", referenced from:
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in Button.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ViewModel.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in Inventory.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in AddView.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ScannerView.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in RegisterView.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ContentView.o
...
(maybe you meant: __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This condition also occurs if you add
import XCTest
to a file in a non-test bundle.
I solved this error by navigation to target app settings > Build Phases > Link Binary With Libraries > add the linked library "XCTest.framework".
If afterwards your app starts crashing, aborting with the following errors:
dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest
0_abort_with_payload
Then you can take a look at the suggestions on this thread: Xcode 5.0.2 dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest
The solution that worked for me was:
Navigate to target app > Build Settings > Linking > Other Linker Flags > editing or adding -weak_framework "XCTest"
This error randomly started to occur on my Xcode project today. I changed the setting.
PROJECT -> Build Settings -> Build Options -> Enable Testing Search Paths
from No to Yes, and the build succeeded.
Edit:...
This setting is on by default if the project is created with a testing target included. In my case I believe I added the testing target later so this setting will have been false. Although, I can't say why it didn't break as soon as I added the testing target.
See:
https://xcodebuildsettings.com
None of the above worked for me. In my case, a couple of mock files were targeted to both the framework and unit testing bundle. I just unticked the framework one to get rid of this error on the inspector.
I solved this error by navigation to target app settings > Build Phases > Link Binary with Libraries > add the linked library "XCTest.framework".
The action above is totally the same as the solutions above, though the issue "Library not loaded" appeared raised.
I solved the "Library not loaded" issue by setting up the framework to be optional while linked library.
[enter image description here][1]
It works for me in Xcode 13.2.1.
in xCode7 build setting tap, i add flag as below:
other c flags: -fsanitize=address
other linker flags:-fsanitize=address
It works well on the simulator, but when I run the app on an iOS device, it crashes.
The error information is:
dyld: Library not loaded: #rpath/libclang_rt.asan_ios_dynamic.dylib
Referenced from:
/var/mobile/Containers/Bundle/Application/6DFB6F58-A283-4F82-A4B5-903E12B7D0CA/EduLayout.app/EduLayout
Reason: image not found。
so how to fix it?
i am using xcode 6 . application runs successfully on simulator but when i am using my device than after building the application it is crashed and sending this report. this code was running with xcode 5.
dyld: Symbol not found: _NSURLAuthenticationMethodServerTrust
Referenced from: /var/mobile/Applications/7BA2B5A2-E764-46F6-A012-8FB94BCD1C4C/FutureAPI.app/FutureAPI
Expected in: /System/Library/Frameworks/CFNetwork.framework/CFNetwork
in /var/mobile/Applications/7BA2B5A2-E764-46F6-A012-8FB94BCD1C4C/FutureAPI.app/FutureAPI
answer is https://github.com/AFNetworking/AFNetworking/issues/2109. i have just deleted CFNetwork.framework and my code is running.
Background:
I'm trying to use a Phonegap with cocoapods. Phonegap already has issues compiling from command line so I'm just using Xcode with the generated project file (and assumably I'd have to do that anyway when using cocoapods).
I've pushed up on Github a reproduced empty project with my problem:
https://github.com/Dan2552/phonegap-reproducable-issue
You can see the steps I made after making a plain brand-new Phonegap app in the build_ios script in the root directory on the repo. But I've also pushed up the generated project files (platforms/ios) so anybody without Phonegap should be able to open the project.
Problem:
I'm having a weird issue with compiling. Probably issues with the pre-bundled Cordova library and cocoapods.
When building without doing anything after generating the project with Phonegap and adding in the cocoapods, I get the following errors:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_OTPublisher", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
"_OBJC_CLASS_$_OTSession", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
"_OBJC_CLASS_$_OTSubscriber", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cocoapods warns:
[!] The target HelloWorld [Debug] overrides the OTHER_LDFLAGS build setting defined in `Pods/Pods.xcconfig'.
[!] The target HelloWorld [Debug - Release] overrides the OTHER_LDFLAGS build setting defined in `Pods/Pods.xcconfig'.
and therefore I tried deleting the OTHER_LDFLAGS ('Other Linker Flags' in Xcode) entry altogether. This successfully compiles on an iOS device, but not on the simulator, nor will the project build on archive.
Building for simulator will get the same error as before (Undefined symbols for architecture)
Building for archive will get
/Users/dan2552/projects/ReproducableProblems/OpenTokPhonegap/Classes/OpentokPlugin.h:9:9: 'Cordova/CDVPlugin.h' file not found
I've also tried putting $(inherited) in the OTHER_LDFLAGS which produces the same results as deleting them.
Your included framework has no Simulator (i386) slice:
$ xcrun -sdk iphoneos lipo -info Pods/OpenTokSDK-WebRTC/Opentok.framework/Versions/A/Opentok
Architectures in the fat file: Pods/OpenTokSDK-WebRTC/Opentok.framework/Versions/A/Opentok are: armv7 armv7s
So its classes can't be linked for the Simulator.
Also if you plan to use CocoaPods you could remove the Cordova project and static library entirely and add pod 'Cordova' to your Podfile.
I've seen similar issues before when trying to run the Xcode project, rather than the XCWorkspace. The issue you're having sounds like it's because you're not running the workspace.
Go to your taget Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line .
. Try this
My app crashes while loading dynamic library, which I don't explicitly request.
Full crash:
sharedlibrary apply-load-rules all
dyld: Symbol not found: ___gcc_personality_sj0
Referenced from: /var/mobile/Applications/44B11CD4-6109-4970-88E9-467552DB86DD/Pro.app/Pro
Expected in: /usr/lib/libSystem.B.dylib
in /var/mobile/Applications/44B11CD4-6109-4970-88E9-467552DB86DD/Pro.app/Pro
Try weak linking to libSystem.B.dylib.
In your project build settings under "Other Linker Flags" add the
following:
-weak_library /usr/lib/libSystem.B.dylib
It should automatically be added to your Target build settings but if
it isn't you should add it there as well.