50

My app is crashing with the message:

dyld: Symbol not found: _NSURLAuthenticationMethodClientCertificate
Referenced from: /var/mobile/Applications/C7B596AD-FB09-4685-BDFC-7E955A5DD185/IRON TRAINERS.app/IRON TRAINERS Expected in: /System/Library/Frameworks/CFNetwork.framework/CFNetwork in /var/mobile/Applications/C7B596AD-FB09-4685-BDFC-7E955A5DD185/IRON TRAINERS.app/IRON TRAINERS (lldb)

when I try to build and Run. When I remove the CFNetwork from my project, it works, I don't know why.

I just installed Xcode6Beta and opened my project. It was working fine on Xcode5.1.

UPDATE:

It works fine on iOS simulator with Xcode 6, the problem is on my device running iOS 7.1.1.

UPDATE 2:

The selected answer below worked for me, although I already had foundation framework explicit added to my project, I had to remove it and add it again. Problem solved, at least, for now. :)

Jorge
  • 1,492
  • 1
  • 18
  • 33
  • 3
    Yep, mine does that as well. Runs fine in Xcode 5.1 iOS7.1, but gives the exact same error (except the target name of course) in Xcode6 iOS8... It suspect it's related to some HTTPS calls I do in the app. But since I don't do anything advanced/manually in that regard, I might think it's a bug in the beta version. – Elechtron Jun 05 '14 at 07:56
  • 1
    Yes, I think you are right. Since I use parse.com for backend, I don't even know where this is happening. But surely some parse commands I use are making the network calls and returning the error. – Jorge Jun 05 '14 at 11:43
  • I'm not sure wether we are allowed to talk about xcode6 in public as apple is only sharing this app in the beta section. Xcode5 and earlier doesn't have this issue. But maybe the next beta solve this problem – Vinh Jun 16 '14 at 09:55
  • This post solved the problem for me: – WOODE Soft Jul 11 '14 at 14:26

11 Answers11

89

Edited to include two possible steps you need to take:

  1. Make sure you have Foundation framework to your project. (Remove and add it again to be sure).
  2. Make sure the Foundation framework include is before CFNetwork.

There seems to be a change in which headers include what in iOS8.0 (the glextensions file, for example, is no longer in the top header). If you explicitly add Foundation framework to your project, it will build fine. Making CFNetwork optional will, of course, lead to failures and is only a solution for the build error and not a solution overall.

enter image description here

meda
  • 45,103
  • 14
  • 92
  • 122
plluke
  • 1,905
  • 11
  • 9
  • 2
    It was already in my project, but I removed it and inserted again. It seems like it's working now. Not sure what happened there, though. Let me run a few tests and I'll send you feedback. Thanks. – Jorge Jun 08 '14 at 21:20
  • @Jorge I've seen problems with state in the past too where the pbxproj gets confused so good thinking removing/adding. I'll edit to include that trick. My project has been working well after this, hope yours does as well. – plluke Jun 08 '14 at 23:48
  • Just changed CFNetwork to optional, figured I should check online, and then saw your post. Thanks for saving me some future headaches... – Hari Ganesan Jun 10 '14 at 14:59
  • 1
    For convenience, it was sufficient for me just to uncheck the Target membership checkbox for Foundation.framework and check it again. – Gary Makin Jun 20 '14 at 06:18
  • 2
    Actually this do not solve the problem! what solves is the other answer from Lap.felix: Reorder your frameworks to have Foundation before CFNetwork. – João Nunes Jul 03 '14 at 11:02
  • @JoãoNunes Thanks for the clarification. For me I didn't have foundation at all, which was the problem/change I could see in iOS8. If you already had foundation added then, yes, it will need to precede CFNetwork in order for the new include to make a difference. – plluke Jul 03 '14 at 12:34
  • @plluke I would update your answer and mention that due to a bug(mentioned also in one answer) you need to reorder the Frameworks. – João Nunes Jul 04 '14 at 12:40
  • @plluke I'm facing same problem, and I'm not using CFNetwork.framework in my project. if I imported it and make it option then project run but not able to fetch data from server, its not crash but stop on splash screen and not enter into home screen. can any one please help me on this........ – sandy Jul 09 '14 at 10:01
  • This worked for me. Does the sequence of adding Framework matters? – Jayprakash Dubey Jul 23 '14 at 12:45
  • @JayprakashDubey It does seem to in certain situations. Honestly I'm hoping this to be fixed by the time iOS8/Xcode6 goes GM so I see this as a temporary workaround. If this still persists as we get closer to GM then I'd probably dig deeper into the exact root cause. – plluke Jul 23 '14 at 18:14
  • Thanks a lot, all I had to do is drag foundation above CFNetwork and voila, I added a screenshot. – meda Aug 01 '14 at 14:03
  • I can confirm it works and the order really matters. Drag Foundation.framework on top of CFNetwork.framework to do the trick! – Claus Aug 21 '14 at 10:43
38

I had a similar issue with UIAlertAction

dyld: Symbol not found: _OBJC_CLASS_$_UIAlertAction Referenced from: /var/mobile/Applications/ ....app/ ... Expected in: /System/Library/Frameworks/UIKit.framework/UIKit in /var/mobile/Applications/ ....app/ ...

Making UIKit.frameWork Optional solved my issue. In your case I am guessing, making your CFNetwork.framework optional will solve your problem too.

Make your <code>CFNetwork.framework</code> optional

Warif Akhand Rishi
  • 23,920
  • 8
  • 80
  • 107
  • Thanks, I'll try. But I'm worried if on doing that, I may get a crash when the framework is needed. And I wont know until it happens, since I use a few API's that make network connections. Does that make sense? – Jorge Jun 05 '14 at 15:01
  • @Jorge I couldn't find any documentation on that. But my crash solved and app working as usual. I know because I have tested. We could never be sure without testing network connections on the app. – Warif Akhand Rishi Jun 05 '14 at 15:57
  • @Jorge btw does it still crash after making the framework optional? – Warif Akhand Rishi Jun 05 '14 at 16:01
16

Re-ordering in XCode didn't do the trick; I'm using Cocoapods, which creates a Pods.xcconfig file. This has a OTHER_LDFLAGS line. I put -framework Foundation as the first entry, and that's made my project work.

OTHER_LDFLAGS = -framework Foundation -ObjC …

(Beware, this file gets re-generated each time you pod update.)

Graham Perks
  • 23,007
  • 8
  • 61
  • 83
  • thanks, it take me out. Cocoapods configuration overwrite the xcode. This is the solution for cocoapoders. – Nickolas Sep 13 '14 at 07:46
11

Reorder your frameworks to have Foundation before CFNetwork.

That's a temporary fix to something that is obviously a bug in Xcode 6.

Felix Lapalme
  • 1,058
  • 1
  • 11
  • 25
6

I ran into this exact problem at WWDC. I spoke to a couple of Apple engineers who told me this is a bug in the SDK caused by moving some symbols between CFNetwork & Foundation, and that it would be resolved in the next release, due very soon. You can work around it in some cases by playing with the order frameworks are imported, but it won't always work.

2

I had the same problem using sqlite3 with Xcode 6.3 on a device running iOS 8.1.3 and so using sqlite3 v3.7.13.

The C function sqlite3_errstr() was introduced in sqlite3 v3.7.15.

My code was calling sqlite3_errstr().

The application was crashing on launch.

Setting libsqlite3.dylib as optional (rather than required) did the job.

Nicolas Buquet
  • 3,880
  • 28
  • 28
1

The few times it happened with me a simple Clean (shift + cmd + K) did the trick.

1

I got some error similar: dyld: Symbol not found: _NSDictionary0 By the link: I reset my related projects' Deployment target to same value: 8.0, then it ok. May be something changed in ios9.0 and ios8.0, so if we want to make 8.0 compatible, we should make the related projects to know.

dyld: Symbol not found: ___NSDictionary0__ when using google ServiceGenerator binary with discovery docs in XCode 7 & iOS target 9.0

Community
  • 1
  • 1
Huangzy
  • 149
  • 1
  • 6
1

In my case it happened when I updated 3rd party library using CocoaPods.


Simply Clearing Build Folder helped K

Robert Dresler
  • 10,580
  • 2
  • 22
  • 40
0

Make CFNetwork.framework optional it worked for me

0

In my case I had a framework with the same name as an Apple internal framework named AuthKit. So during run time it was trying to look for a symbol AKAppleIdSession in my AuthKit framework instead of apple's framework. Thus leading to crash with error Symbol not found

Pranav Gupta
  • 741
  • 9
  • 10