0

For a slow-loading VC, I decided to delete all the excess code that was commented out. Before doing this I copied all the code from the class into TextEdit and saved it to my desktop. Then I began cutting out extraneous code but because there was a mixture of // and /* */ in the course of cutting it out I accidentally deleted a closing brace causing the entire remainder of the code to turn green.

Because I couldn't immediately figure out what I had cut correctly and whether I cut too much, I decided to copy the entire contents from the backed up textEdit file and replace the original code in the class--or so I thought. However, since doing that the App will no longer run as it gives the following error:

Ld /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Products/Debug-iphoneos/idaru.app/idaru normal armv7
    cd /Users/M/Desktop/War/idaru
    export IPHONEOS_DEPLOYMENT_TARGET=7.1
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Products/Debug-iphoneos -F/Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Products/Debug-iphoneos -filelist /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/idaru.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.1 -framework MessageUI -framework SystemConfiguration -framework CoreLocation -framework MapKit -framework Social -framework AddressBook -framework Accounts -framework CoreGraphics -framework QuartzCore -framework CoreData -Xlinker -dependency_info -Xlinker /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/idaru_dependency_info.dat -o /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Products/Debug-iphoneos/idaru.app/idaru

duplicate symbol _OBJC_IVAR_$_SettingsVC._reportProblemRow in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._profilePic in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._pushNotification in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._emailNotification in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._pushChanged in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._emailNotificationChanged in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._demo in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_IVAR_$_SettingsVC._managedObjectContext in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_CLASS_$_SettingsVC in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
duplicate symbol _OBJC_METACLASS_$_SettingsVC in:
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/SettingsVC.o
    /Users/M/Library/Developer/Xcode/DerivedData/idaru-bwkkgfbrgtgsmffxqcifyjsoehdq/Build/Intermediates/idaru.build/Debug-iphoneos/idaru.build/Objects-normal/armv7/IDSettings.o
ld: 10 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is new to me and I can't figure out what to do. The name of the file that I copied from textEdit was SettingsVC. There is also another file in the project called IDSettings that does something different, however, I did not do anything to that.

There are no red image files in the navigator pane. However, the xctest file is in red although I've read this is not unusual.

Would appreciate any advice on how to fix this problem.

2 Answers 2

1

The error report says clearly that there are a lot of duplicate declarations in the files SettingsVC and IDSettings.

Press ⇧⌘F and type for example reportProblemRow to find the duplicates and delete or comment out one of them.

Remove or comment out all other duplicates the same way.

Sign up to request clarification or add additional context in comments.

3 Comments

There have been identical variables in SettingsVC and IDSettings for some time. And can't you use the same variable name in different VCs? Why would this suddenly be an issue now?
You can, if they are declared within the scope of a class, struct or enum. But not in the same scope e.g. outside any class, struct or enum.
Your answer pointed me to issue. I pasted the code into the wrong file so I did end up creating two copies of the same code in different files. Thank heavens for backups.
0

Their is not any definite answer for this kind of problem. Even then try this steps may be this can help you.

Solution 1

You may be imported .m file instead of .h

Solution 2

Remove the -ObjC Linker flag from Other Linker Flags under the `project settings'

Solution 3

You may accidently added two same files or frameworks.

Solution 4

Run you project in X-Code 7 in some cases it solves the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.