I am trying to update my project to use ARC and I use JSONKit so I went in the 'Build Phases' tab under 'Compile Sources' and added the argument '-fno-objc-arc' but I still get errors all over the place. I thought that was suppose to prevent this from happening?
What am I missing on this?
That is correctly how you implement it. What files did you include that flag on.
I am using AFNetworking and I had to put that flag on each file that AFNetworking had me include.
Adding to each file allowed the arc processor to ignore these files.
are you sure it is all lower case and that there are no spaces in the wrong places?
Related
When I'm writing simple code in ViewController, I wanted to run it and boom. Apple Mach-O linker error as shown. I don't know what is the problem. Then, I've made a quick research, according to research; I deleted Derived Data folder, I deleted Derived Data folder contents, I deleted test hosts in build settings(it is already empty), I cleaned the build folder and I applied clean action. But nothing changed same errors. Is there any specific solution of this error depends on app and what is that solution?
EDIT:
I moved the codes to a new xode project and I noticed that when I add the line let ftp = CkoFtp2(), the error occurs otherwise it compiles. But it is coloring the CkoFtp() part of line and I'm not getting any specific errors there. Just Match-O and linker command.You can see the CkoFtp2 code here.
I had the same issue. Please make sure to follow the directions on chilkat's site, particularly the following:
Add libChilkatCocoa.a to your list of libs for linking. In your project build settings, find Build Phases, Link Binary with Libraries, select Add Other, navigate to the libChilkatCocoa.a, and add it.
The Chilkat library internals are written in C++. Therefore, your Swift application will need to link against the C++ runtime libraries. In your Build Settings, go to the Linking section and add -lstdc++ to the Other Linker Flags.
https://www.chilkatsoft.com/chilkatSwiftCocoa.asp
I also ran into trouble because the libChilkatCocoa.a library resided in a folder that had a space in its name. Avoid that, or make sure it is correctly escaped under Build Settings.
Looks like you've got a reference to a framework located in your Downloads folder. Chances are you moved that somewhere else, yes? Remove the SimpleUnzipper framework from the project and re-add it from wherever you moved it to.
After the edits, this is clearly not the problem...
It's hard to tell from just the error message, but it appears that you're using a library that you downloaded from another developer. Are you sure you followed their instructions for setting things up? The linker error means that you're not linking your program with the library, though it looks like you've managed to set up a bridging header so that you can call the function without getting a compiler error.
I have a app with the WhiteRaccoon framework installed.
I cant compile it as it gives me errors with anything to do with retain or release in WhiteRaccoon.m/h.
Any ideas whats going on?
Thanks.
By the way, I have added the CFNetwork framework. Any ideas?
Your project is probably using ARC and WhiteRaccoon probably isn't.
You can either convert whiteRaccoon (whatever that is) to ARC or exclude the whiteRaccoon files by adding the following compiler flags to it's source files -fno-objc-arc.
To do that click the project on the left hand side then go to the "Build Phases"-> "Compile Sources" look for the white Raccoon .m files and add the -fno-objc-arc under the compiler flags section.
Another option would be to compile the WhiteRaccoon framework into a static library and as this to your project.
Is there an iOS 5 arc compatible lazy Image loading library? I've not found one.
My next thought is to make EGOlazyloading a compiled library and link it to my project. Would that work? Any pointers on going about?
Thanks!
I wrote one. You can download it here:
https://github.com/nicklockwood/AsyncImageView
Alternatively, if you do want to use EGO, or some other library, select Edit>Refactor>Convert to ARC and in the dialog that comes up there's a little drop down to select which files to convert.
Just tick the files that should be converted to ARC and un-tick ones which shouldn't be. If a file is already using ARC then leave it ticked (it won't double convert it).
That gives you the option of either trying to convert the library files to ARC or to leave them alone. Files that are unticked will be marked with the -fno-objc-arc flag automatically so you won't have to do anything.
Byron, you could just use a regular library like EGOlazyloading you suggested and order the compiler not to use ARC on those specific files by adding the flag -fno-objc-arc in "Build Phases -> Compile Sources"
I have already created a project in XCode 4.2 with ARC checked. The problem is that I have to download and add the ASIHttpRequest files. This is giving a whole bunch of errors when I try to compile. Is there some way to fix this (other than to create a project again) ?
Click on the name of the project on the navigation view in the left side, go to Targets -> Build Phases and add -fno-objc-arc to the "compiler flags" for any relevant files.
You can turn off ARC per-file by passing the flag -fno-objc-arc to each as they are compiled. Add the flag to the files that need ARC disabled in the Compile Sources group under the target in the project navigator.
Another option would be to compile ASIHttpRequest as its own framework that doesn't have ARC enabled and just link against the framework. Speak of, isn't ASIHttpRequest already in a framework? (I've not looked at it in a while)
Keep using ARC, but disable it for the ASIHttpRequest files. This answer should point you in the right direction:
How can I disable ARC for a single file in a project?
I recently deleted a viewcontroller from my project (both .h and .m files) but know I get a 'missing file' warning every time I build.
Any ideas on this and is it something I need to worry about?
Appreciated
This is probably a version control issue if you are using svn or git. I had this problem and solved it using the solution provided in this post:
Missing file warnings showing up after upgrade to XCode 4
I recently faced the same scenario. Adding and deleting did not work for me.
However, I added them once more and right clicked on them. Under source control, I Discarded the changes and then deleted the files(Move to trash). This worked for me !!!
Ensure that it's not referenced anywhere in the project.
Look at the files on the bar on the left, make sure it's not there. Missing files are colored in red.
Ensure that none of your files #import the file.
Also, in the future, avoid storing files in parent directories. ../../ isn't something you want to use.
You likely have a 'dangling reference' in your target's list of files to compile or copy -- check your compile and copy phases for the target which emits the warning.
If it's been physically deleted, the simplest way is usually to enter the file name into the project navigator's search field - look for what Tom detailed - then delete the files from the project(s).
I had a similiar problem. I was trying to delete a .h and .m and I wanted to remove the files entirely, but kept getting errors if I chose "Move to Trash" instead of just "Remove Reference".
Turns out, I needed to just delete each file INDIVIDUALLY. Just add the files back in (if you have them somewhere) and re-delete them one at a time. Worked for me!