Error to compile after to add internationalization iphone - iphone

I have a problem. I have a iphone Project in Xcode 4, and I this project compiled perfect, but I have add internationalization to application and now if I try compile the application compile Failed, and give me the next error: "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1"
"ld: duplicate symbol _OBJC_IVAR_$_Detail.tweets in /Users/user/Library/Developer/Xcode/DerivedData/ApplicationName-cofhylaattdxjreknuzixudblevt/Build/Intermediates/ApplicationName.build/Debug-iphonesimulator/ApplicationName.build/Objects-normal/i386/Detail-7AC84D3333010C52.o and /Users/user/Library/Developer/Xcode/DerivedData/ApplicationName-cofhylaattdxjreknuzixudblevt/Build/Intermediates/ApplicationName.build/Debug-iphonesimulator/ApplicationName.build/Objects-normal/i386/Detail-A96D1FAB88823E17.o for architecture i386"
What I can do to make it work?
Thank you.

Did you accidentally created a localized version of an .m file?
From the error message it sounds like you have two times the same file with your object.
If you did it on purpose because you wanted to localize all those #"words" in your code, you did it wrong.
In that case read the iPhone Applications Localization Guide.

Related

unable to open dependencies file Swift 4.2

Upon upgrading my code to Xcode 10 and Swift 4.2 I can't build with my custom Objective C classes.
This is a sample error:
error: unable to open dependencies file (/Users/James/Library/Developer/Xcode/DerivedData/INDX-czfaxcphlmzffxehpjcbkopvgczo/Build/Intermediates.noindex/INDX01.build/Release-iphonesimulator/INDX01.build/Objects-normal/x86_64/MoreTableViewDataSource.d)Command CompileC emitted errors but did not return a nonzero exit code to indicate failure
Yes I deleted the derived data folder, cleaned, podded, etc, over and over again and check some flags for good measure.
Nothing changed just the upgrade. Thoughts?
Gave up. Converted those Objective C classes into swift. It compiles and runs now. Maybe Apple is being aggressive to weed out Objective C ?

MacOS Swift Framework testing fail

I have a framework written in obj-c and swift.
Now i try to run a related unit test target, but I get this error:
2014-07-10 07:45:54.064 xctest[4908:303] The test bundle at /Users/steve/Temporary/Build/Products/Debug/SOGraphDB-Mac Tests.xctest could not be loaded because an unanticipated error occurred: Error Domain=NSCocoaErrorDomain Code=3587 "The bundle “SOGraphDB-Mac Tests” couldn’t be loaded because it is damaged or missing necessary resources." (dlopen_preflight(/Users/steve/Temporary/Build/Products/Debug/SOGraphDB-Mac Tests.xctest/Contents/MacOS/SOGraphDB-Mac Tests): Library not loaded: #rpath/libswiftAppKit.dylib
Referenced from: /Users/steve/Temporary/Build/Products/Debug/SOGraphDB.framework/Versions/A/SOGraphDB
Reason: image not found) UserInfo=0x10011c640 {NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Users/steve/Temporary/Build/Products/Debug/SOGraphDB-Mac Tests.xctest/Contents/MacOS/SOGraphDB-Mac Tests, NSDebugDescription=dlopen_preflight(/Users/steve/Temporary/Build/Products/Debug/SOGraphDB-Mac Tests.xctest/Contents/MacOS/SOGraphDB-Mac Tests): Library not loaded: #rpath/libswiftAppKit.dylib
Referenced from: /Users/steve/Temporary/Build/Products/Debug/SOGraphDB.framework/Versions/A/SOGraphDB
Reason: image not found, NSBundlePath=/Users/steve/Temporary/Build/Products/Debug/SOGraphDB-Mac Tests.xctest, NSLocalizedDescription=The bundle “SOGraphDB-Mac Tests” couldn’t be loaded because it is damaged or missing necessary resources.}
Any idea what the root cause can be?
The error seems realated to "Library not loaded: #rpath/libswiftAppKit.dylib"
Both (framework and test bundle) compile without any error or warning (in Beta2)
I had a similar problem, though mine was an iOS test target, linking to a Swift framework, that failed to run on Xcode 6 GM. The test target had run successfully on an early beta of Xcode 6, but the final version reported the runtime error: Library not loaded: #rpath/libswiftCore.dylib
I noticed that a newer project did not have the failure, so I compared the build settings and test code. I was able to resolve the problem with three steps:
The test target needs the "Embedded Target Contains Swift Code" setting to be YES. This tells the linker to add the Swift runtime libraries to the executable.
The test target needs an explicit value for the "Runpath Search Paths" build setting. This tells the loader where to find the Swift runtime libaries. I copied the following setting from a fresh new test target:
LD_RUNPATH_SEARCH_PATHS = $(inherited) #executable_path/../Frameworks #loader_path/../Frameworks
The test cases need to explicitly import any modules that are used by the linked framework. In my project, the framework used UIKit but the test cases only used my framework. When I added an explicit import UIKit to the test cases, the link problem went away.
Since I keep running into this issue whenever I mess with build settings, here's the cleanest answer I can provide as of Xcode 8b5:
If unit tests don't run on iOS, make sure you have:
Runpath Search Paths: #loader_path/Frameworks
If unit tests don't run on macOS, make sure you have:
Runpath Search Paths: #loader_path/../Frameworks
This will show up as LD_RUNPATH_SEARCH_PATHS in your pbxproj file. You can also add $(inherited) to make sure project-wide paths are added as well, but those are probably empty.
Lastly, I didn't need the executable_path/... settings, doesn't make a difference for me whether they're there or not for unit tests.
I had the same problem.
Ended up copying libswiftAppKit.dylib out of the Xcode application directory (I am using beta 3), into a directory that I could reference (not part of an application bundle), then adding the library to the "Link binary with libraries" setting for the test bundle. My tests then started working.
FYI, the path for the dylib was at '/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftAppKit.dylib'
Probably not a good final solution, but it works for the interim.
My solution was to add a single file to my test target, AppKitTests.swift (or AppKitSpec.swift in my case), and all the file contains is:
// While I don't know why, The.framework is built linked to libswiftAppKit.
// Frameworks do not embed the Swift libraries themselves, it's up to the host
// app to include the necessary libraries. So here we are, including AppKit on
// behalf of The.framework so that the tests can run.
import AppKit
Oh, I also added AppKit to the test target's set of frameworks.
I had this occur to me in Beta 4 and it turned out that I had done it to myself without realizing it.
I had a Framework project called Fnord. My FnordTests target contained a couple of unit test classes that had import Fnord at the top of each file. For some reason Xcode was complaining about those imports and so I commented them out. This is when I started getting the same symptoms while trying to run my unit tests.
I noticed that the settings for my FnordTests target were such that the target would be linked with Fnord.framework, and I realized that it might not be able to do that with the aforementioned import Fnord statements diked-out.
So I put them back in, and everything went back to normal. Curiously, Xcode no longer showed those import statements as being problematic, but this is beta so I can forgive that.
I hope this helps someone.
I ran into the same issue, adding
import AppKit
in the Swift file fixed it

mpglib_interface.c 'interface.h' file not found

I an trying to compile the WunderRadio app source code available here http://dev.wunderground.com/support/wunderradio/wunderradio.1.9lgpl.zip. After making all the modifications to the project to compile on iOS5 i get the following error:
Lexical or Preprocessor Issue 'interface.h' file not found.
Of course i tried getting the interface.h from the lame library that i previously downloaded, and added it to the project with no luck. Apparently its not the right file.
What am i missing ?
I found this file at:
http://code.google.com/p/live-converter/source/browse/trunk/include/interface.h?r=13

Struggling with Xcode 4

I've recently downloaded Xcode 4 and now two of my projects that were working perfectly fine before have started giving me errors. Both errors are effectively to do with linking options, but I can't figure out how to change these options and get rid of the errors.
The first problem is with a project written in C++ using the SDL_ttf and SDL_image frameworks. The project builds correctly, but when I try to run, it gives me the following warnings on the console:
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_ttf.framework/Versions/A/SDL_ttf (file not found).
warning: Unable to read symbols from "SDL_ttf" (not yet mapped into memory).
warning: Unable to read symbols for #executable_path/../Frameworks/SDL_image.framework/Versions/A/SDL_image (file not found).
warning: Unable to read symbols from "SDL_image" (not yet mapped into memory).
Since the files are not being found, the executable cannot load any images making it exit straight away when I try to load images. I think the issue here is that the frameworks are not in the directory above the executable, they are in /Library/Framework/ which worked fine before in Xcode 3.2. How do I resolve this?
The second problem comes when compiling an application I wrote for iOS. Along with giving me a bunch of warnings about depracated code on iOS 5, which I will deal with later, it fails to build due to a linker error which I have no clue how to resolve, it says:
ld: library not found for -lz.1.2.3
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
I can answer the second question.
-lz.1.2.3
should be
-lz
You might have accidentally added the zlib.1.2.3.dylib to the project's "link binary with libraries" build phase. You should use the standard zlib without any version in its filename, or simply add -lz to the Other Linker Flags under Build Settings and not add zlib in the "link binary with libraries" build phase.
As for the missing frameworks my best guess is that it has to do with the relative path, ie if you can get rid of the /../ part and instead provide an absolute path that might resolve the issue.

CLANG giving errors complaining about defective header file UILocalizedIndexedCollation.h

I ran into this error when building my code with CLANG:
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:31,
from /Users/waspfish/Documents/NanaimoStudio/Projects/iPhoneMonk/Projects/IdeaOrganizer/IdeaOrganizer_Prefix.pch:13,
from :1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:13: error: syntax error before ‘AT_NAME’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:21: error: syntax error before ‘}’ token
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalizedIndexedCollation.h:23: fatal error: method definition not in #implementation context
compilation terminated.
{standard input}:32:FATAL:.abort detected. Assembly stopping.
I ended up having to exclude the UILocalizedIndexedCollation.h from UIKit.h and everything built fine. Any idea what could have caused the problem? I can't imagine Apple is shipping a defective header file.
The problem comes from SDK 3.0 which now use gcc 4.2 but scan-build still use /usr/bin/gcc. So you need to tell scan-build to use /usr/bin/gcc-4.2 instead.
scan-build --use-cc=/usr/bin/gcc-4.2 xcodebuild -configuration Debug
Et voila!
Apple’s engineer had confirmed that they had a bug in UIKit framework:
We do have a simple workaround for this UIKit bug. In UILocalizedIndexedCollation.h change this:
UIKIT_EXTERN #interface UILocalizedIndexedCollation : NSObject
to
UIKIT_EXTERN_CLASS #interface UILocalizedIndexedCollation : NSObject
Denis2342
Usually when I see something like this I clean the build and restart Xcode, then things were fine. With GCC 4.2 sometimes a bad pch could cuase hiccups like this, but clang uses a totoally different pch implementation. You may want t completely delete the build dir while Xcode is not running.
Technically clang is not supported for iPhone development, but I use it for simulator compiles , and I do not see the compile errors you are seeing, so (at least for me) it works. One thing sticks out in my head, you refer to editing your UIKit.h. I understand what you did that, but tweaking system headers is big no-no. Is there a chance you have done that for other reasons, because if you are not running stock headers there any number of reasons this could be happening.