I am getting mysterious console errors when building my application since I updated Xcode to 6.1 from 5. The application works fine, but I'd like to find out what is causing these errors and get rid of them.
Errors are as follows. An exception breakpoint just halts in main, so no real clues there.
2014-11-08 09:30:28.800 Finances[5848:1545133] Failed to connect
(accountSupplementaryDataValue) outlet from (FINAccountEditorWindowController) to
(NSWindow): missing setter or instance variable
2014-11-08 09:30:28.800 Finances[5848:1545133] Failed to connect (delegate) outlet
from (FINAccountEditorWindowController) to (FINAppDelegate): missing setter
or instance variable
objc[5848]: Class _NSZombie_OS_dispatch_queue_runloop is implemented in
both ?? and ??. One of the two will be used. Which one is undefined.
Any ideas?
Apparently you can ignore it? From Greg Parker’s Twitter feed: “Race in the zombie implementation, maybe? You can ignore it.”
For me when I had those problems I carefully went through them and googled them bit by bit to solve them. Though for some what I did was put the file on a flash drive and delete the file from my computer and then reboot the Xcode and with some the computer too and put the projects back on from the flash drive. If that don't work then maybe try loading them on to a computer with Xcode 5 and seeing if the errors are still there?
I am getting this error suddenly when running my app via iPhone simulator:
clang: error: linker command failed with exit code 1 (use -v to see
invocation):
ld: duplicate symbol _OBJC_CLASS_$_Algebra5FirstViewController in
.../Algebra5-anwcuftojtxtgkfootneeeqhwztj/Build/Intermediates/Algebra5.build/Debug-iphonesimulator/Algebra5.build/Objects-normal/i386/ExercisesViewController.o
and
.../Algebra5-anwcuftojtxtgkfootneeeqhwztj/Build/Intermediates/Algebra5.build/Debug-iphonesimulator/PSLE
Algebra5.build/Objects-normal/i386/PSLE_Algebra5FirstViewController.o
for architecture i386
What is it all about?
It look like the class Algebra5FirstViewController is compile multiple time.
Can you make sure that the .m and .mm is only included once in your project sources in Xcode? You can also confirm this by checking in the compile log (last icon at the right, next to the breakpoints icon) and see that confirm that it is only compiled once.
Also, if this class is part of a library that you link against and you have a class with the same name, you could have the same error.
Finally, you can try a clean and rebuild, just in case the old object files are still present and there is some junk in the compiled files. Just in case...
EDIT
I also note that the second reference is made in the file for ExercisesViewController. Maybe there is something in this file. Either you #imported the Algebra5FirstViewController file instead of the .h, or the ExercisesViewController has #implementation (Algebra5FirstViewController) instead of #implementation (ExercisesViewController), or there was some junk with this file that will cleaned with a Clean an Rebuild.
That can happen if the same .m file is referenced multiple times in your target's "Compile Sources" section in "Build Phases". Remove duplicate entries and you should be fine.
also had this problem by declaring a const * NSString in the header file (incorrectly) instead of the implementation file (correctly)
I got this issue because I accidentally imported the .m instead of the .h. Hope reading this saves someone with same problem some time.
I had same problem. Got it solved!
If you have imported any files into project then check .m (main) file for same does exists in Targets (Project Name) -> Build Phases -> Compile Sources.
If file does not exists then include it using (+) Add button shown.
Also, if duplicate files exists (if any) then delete it.
Now press cmd+shift+k to clean the project. New Build should not display this error.
I got a similar error when adding files from another project, like #paiego explained. My error was that I didn't check "Add to targets". As explained above, I deleted the references and added the files again but this time checking "Add to targets".
I was getting similar error and I got it resolved this way.
Try to set Build Active Architecture Only to NO for 'Pods' project and
your app's target
In one case, I saw this error when dragging a new class' .h and .m into the project. The only solution I found was to remove the references to these files and then add them back via the project menu.
I met it when import a ViewController.m in TableViewController. Try to delete '#import "ViewController.m"' if it exited. Hope this help!
'linker command failed with exit code 1 (use -v to see invocation)'- I got this error when running a phonegap application on iPhone. I changed Build Active Architecture Only to Yes and it worked fine.
It seems that for m, I dragged the files into the project and after that didn't work, clicked file "add files to project". Both were the incorrect approach. just drag it into the projects folder (in finder) that houses the other .h and .m files.
once i got
18 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1
For me this was due to that i have used "const NSInteger" in my switch case.
What i did is change the const NSInteger to enum, and replace the reference with enum values.
This fixed the error for me.
This happens either, some files are missing in the "Compile Sources" section, or duplicate entries are found for some file(s). In my case, I had duplicate entries for two files, I deleted one entry for each of the files, that solved my problem. Hope this helps.
I found this article that provided a solution for me. It pertains to Xcode 7 where the default for No Common Blocks is Yes rather than No in previous versions.
This is a quote from the article:
The problem seems to be that the "No common blocks" in the "Apple LLVM
6.1 - Code Generation" section in the Build settings pane is set to Yes, in the latest version of Xcode.
This caused what I will describe as circular references where a class that was included in my Compile Sources was referenced via a #import in another source file (appDelegate.m). This caused duplicate blocks for variables that were declared in the original base class.
Changing the value to No immediately enabled my app to compile and resolved my problem.
I'm posting a new answer to this because I ran into this error and had to use a different solution that I think is specific to iOS 9.
I had to explicitly disable the Enable Bitcode in Build Settings, which is automatically turned on in the update.
Referenced answer: New warnings in iOS 9
[XCODE 7.1 UPDATE]
First Option That Worked:
I changed the Deployment Target from 7.1 to 8.1 and the error went away.
Hope that helps someone.
UPDATE (day 2): Second time I'm back here in 2 days.
On day 2 I started to get more errors in addition to this annoying error. The problem was a conflicting file that Xcode didn't recognize. I used the links below as help:
"_OBJC_CLASS_$_viewsampleViewController", referenced from:
‘ld: warning: directory not found for option’
And ultimately:
"_OBJC_CLASS_$_viewsampleViewController", referenced from:
I was deleting everything from the FrameWork Search Paths + Compile Resources + Run Script Phases + the pods and then re-installing them again to ultimately find success.
The issue on my size (on day 2) was more of a problem with conflicting files or files that Xcode didn't recognize.
But ultimately, removing everything (mentioned above and in the links), cleaning a lot of times and reinstalling the pods/frameworks/run script phases helped.
Really hope this helps someone.
Running Xcode 4.6.3 on OSX 10.7.5 was able to fix this error by changing Architectures to Native Architecture of Build Machine from $(NATIVE_ARCH_ACTUAL).
I received this once by (accidentally) importing both the .h and .m files into the same class.
I got this error while implementing a subclass without the necessary framework added (MPMoviePlayerController without the MediaPlayer framework, in this example)
I got this same issue when working with Bolts.framework. It turns out that when Bolts gets corrupted, no amount of re-importing will fix the issue. I had to go back to the original download file and reimport it completely from scratch. This fixed it right away. It was such a weird issue that it took me forever to figure it out... hopefully this tip will spare some of you from the same frustrations :)
This occurred for me when I named a UILabel reference and an int the same thing, I didn't get an error when I typed it only when I tried to run it so I didn't realize that that was the problem, but if you have something like a label which is the "score" and you call it score, and name an int which is the score also score then this problem occurs.
Variations on this issue can occur if you have a missing library or file. Check there aren't any missing files in your Project Explorer: they'll be written in red if Xcode can't find them.
"Link Binary With Libraries" had old project name pod library. Fixed after removal.
List item
Project
Build Phases
Link Binary With Libraries
Remove deprecated library.
I had this same issue with a library, and I tried all of the answers listed here and nothing helped.
I ended up simply removing the library from Link Binary With Libraries and then re-adding it and it worked fine.
The only (and unfailing) way to resolve this issue is building test from command line:
xcodebuild -workspace MyProject.xcworkspace/ -scheme MyScheme -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.3.1' test
So, at this point, your compilation will surely fail but you'll see all linking problem. In my case, I had several problem such as:
ld: framework 'Foo' not found
To resolve this, you need to on your target, BuildSettings->Linking->OtherLinkerFlags and remove 'Foo' framework .
Use of unresolved identifier 'ClassName' .
To resolve this, I need to add/check file's target membership to UITest target too.
Other possible problems will be raised by xcodebuild and you can easily fix it.
Simply cleaning CMD + SHIFT + K, then building CMD + B worked for me.
In my case I had a reference to a library in Other Linker Flags. Removing it got rid of the error.
I had the same error.
I had imported a audio frame work that i was no longer using. I removed it (DO NOT DELETE IT!) and it built successfully.
Something got changed at the new SDK and my code suddenly isn't working.
I created a new empty project and created only a UITableView in it.
I used the same code as i've been used to, except the compiler said that i do not need to use autorelease anymore, so i removed it.
Oh, and I replaced retain with strong as i was recommended.
When I run the app it shows the TableView like it should look, but the minute i touch anywhere on screen, like scrolling for example, it crashes with EXC_BAD_ACCESS error.
What do I miss??
You should post some more informations on where your program crashed! But I don't think the mentioned compiler warnings are the reason. You should have tried to run your project with the compiler by turning of ARC (automatic reference count) and see what happens. If you can go back, do that first.
Also maybe there went something wrong with the changes you made because of ARC . If you have not done the changes with the Xcode refactoring tool I recommend you doing so.
Therefor select in the Xcode Menu:
Edit > Refactor > Convert to Objectiv-C ARC...
It will go through your code and apply the changes. Apple recommends though that your project should work without crashes and warnings before using it.
Background
After upgrading xcode4.1/ios4 to xcode4.2/ios5 I am experiencing crashes while the App is loading and before it even enters main().
I have set a break point in main() but it is never reached.
Compiling the project in Xcode 4.1 with a Base SDK of 4.3 works fine on iOS 4.x and iOS 5.
Compiling the same project in Xcode 4.2 with a Base SDK of 5.0 works fine on 4.x but crashes in iOS 5, both on the simulator and on a device.
Simulator Crash
Crashes with EXC_BAD_ACCESS
List of calls, all system calls, not even the main() has not been called yet.
My best guess is a problem loading a library, but have know idea how to track it down!
Attempts at a resolution
Turned on Zombies
Turned on all logging
Added different versions of system libraries (libz.1.2.5.dylib and libz.dylib)
Cleaned the project
Deleted the App form the simulator
Delete the Derived Data folder
What is your deployment target?
My deployment target was iOS4.0. I changed it to iOS4.3 and the issue is resolved! (Building against iOS5 GM SDK, of course.) My app now runs in the iOS5 simulator.
I got this idea from an answer in another SO thread that said ARC is supported in iOS4.3 and above. My app doesn't use ARC, nor do any of it's dependent libraries, as far as I can tell. The answer also said something about weak reference zeroing, which seemed... perhaps relevent since a lot of people have had success in removing specific linker directives concerning weak references to libSystem.B.dylib.
It bothers me a little that I have to move up my base deployment target beyond 4.0 because that feels like I am cutting out a lot of potential users. Despite Apple's hope that everyone will always upgrade their devices, many people do not. Oh well.
EDIT
It's worth mentioning that this project was originally done under Xcode3, so there is likely just some bizarre cruft in the project itself that is both unneeded and causing this problem. But I'll be damned if I can find it!
EDIT 2
Well, well, well... upon further inspection... I found 2 errant references to libSystem.B.dylib in my project.pbxproj file that were not visible through Xcode's build settings, but that I had to remove by hand with a text editor!
Once doing this, I reset the base deployment version to 4.0, built for the iOS5 simulator, and the app ran without issue.
Amazing.
The lesson: Never underestimate the chances for there to be garbage in your project file.
EDIT 3
Removing the 3 occurrences of these lines in the project.pbxprojfile inside the Xcode project package (right click and show package contents).
Check your linker flags. Some libraries you might have been using required a flag like this:
-weak_library /usr/lib/libSystem.B.dylib
The weak linking allowed building against iOS 4.x with a 3.x deployment target. For whatever reason, it's completely broken in the simulator now.
I was playing around with the scheme diagnostics, and got this exact same behavior by accidentally setting "Enable Guard Malloc" on. I had targeteted 4.3 and was running under ARC on the 5.0 Simulator. The app would run fine when launched from the simulator, just not from XCode. Go to Product->Edit Scheme..., select the "Run" item in the table to the left, and then the "Diagnostics" tab to the right. Uncheck "Enable Guard Malloc".
I tried everything in rjstelling and MarkGranoff's posts to no avail. I can now reproducibly cause it to not happen by turning off Guard Malloc on my debug scheme. Guard Malloc on--crash, off--no crash. I never had the problem on the device only the simulator. I applied the fixes in the post above first so I don't know if this would have fixed the problem without those changes or not. Hope this helps someone else.
I had the exact same diagnostic, but the solution was entirely different.
However, the solution described in the answers here didn't work for me, because I found no "weak"-related issues in my project.pbxproj
However, I found that the cause of my problem was a deadlock in an +(void)initialize method called from the main thread. In this method, I was calling dispatch_sync(dispatch_get_main_queue(), ^{[some block code]}). Changing this to a dispatch_async (note the "a") solved my problem.
The way I discovered the issue was accidental. While nothing seemed to happen, the "thread" navigator of Xcode was telling me that the app itself wasn't crashed. And I accidentaly clicked on "pause" in the debugger. And suddenly it stopped exactly where the deadlock was. Which after some thoughts is just logically obvious.
I had similar problem with logic unit testing (running separate target without dependency on the main app in the iOS simulator), in my situation problem was in lldb, here is more details:
Logic unit tests crash
An app crashing before entering main.m can happen when a linked framework doesn't get copied, for example because the project uses Carthage and the Run Script build phase /usr/local/bin/carthage copy-frameworks is missing.
Xcode 4.2 still has some rough edges from my usage. A complete removal and re-install fixed an issue I had (it was stuck on "Attaching" and none of the solutions on the "official" SO thread helped). Might be a bit extreme though.
Select the top-level project in the File Navigator and go to the Build Phases tab. Expand "Link Binary with Frameworks" section—are there any frameworks that aren't Apple-provided? Are they Optional or Required? And does any of your code required any additional frameworks?
To help more could you post all the log messages that are currently being obscured by the call stack popup?
You can apply the linker flag conditionally to iOS SDKs but not the iPhone Simulator in XCode 4.
Select Other Linker Flags, click Add Build Setting, choose Add Conditional Setting, and apply -weak_library /usr/lib/libSystem.B.dylib just for iOS SDK.
This lets simulator builds still work.
Guard malloc was the problem for me too. Probably because I'm using libxml2.2.7.3.dylib.
This question describes the same crash, but he was lucky enough to be turning guard malloc on, so it was obvious what caused the crash. I just got the crash after upgrading Xcode to 4.2.
I'd like to include the stack trace so that it is Googleable. I had trouble finding this page.
#0 0x00000000 in <????> ()
#1 0x99924ef3 in mig_get_reply_port ()
#2 0x9991e70c in mach_ports_lookup ()
#3 0x0141c124 in _xpc_domain_init_local ()
#4 0x01419eb1 in _libxpc_initializer ()
#5 0x8fe2a15b in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
#6 0x8fe29cc0 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
#7 0x8fe27220 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#8 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#9 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#10 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#11 0x8fe271b6 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#12 0x8fe281c0 in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE ()
#13 0x8fe1c626 in __dyld__ZN4dyld24initializeMainExecutableEv ()
#14 0x8fe20ef2 in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#15 0x8fe1a2ef in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKclS2_ ()
#16 0x8fe1a063 in __dyld__dyld_start ()
In my case it was the -objc flag in Other Linker Flags. I had to remove that and it worked like a charm.
I seem to remember having had a similar crashing bug prior to main() being called and I tracked it to a mismatch between IBOutlets declared in app delegate vs in my nibs. Go through and check your outlets to see if any are somehow misconfigured.
-mz
After using Finder to make a copy of my project, the iPhone Simulator crashes giving me an NSInternalInconsistencyException error. I subsequently used Time Machine to restore the project before I made the copy, but am still getting the NSInternalInconsistencyException error.
This is a small homework assignment and re-creating it wouldn't be the end of the world. My big concern is that I don't understand something fundamental about how Xcode is working. Any illumination would be greatly appreciated.
Update
Apple identified the bug. The iPhone Simulator keeps the last-run version of the app onboard, and doesn't replace it with the copied/Time-Machine-Restored version that is in Run-and-Build. Deleting the app from the iPhone Simulator and performing a new Run-and-Build resolves the issue.
Sounds like a bug. Your source code files should be fine, so hopefully it's not a big deal to just create a new project and add those files so that you can get back to work. You might also want to report the issue to Apple, especially if you can make it happen again.