jsonkit user defined issues and arc restrictions on trying to import it from objective c - objective-c

So it's my first time to try and use jsonkit. I've been looking for the past hour and couldn't find any installation instructions so I just tried copying and pasting the files and then adding them into the xcode project and then import them. But when I compile it would throw a dozen errors, which would usually have ARC restrictions on it. One of these errors has this :
JSONKit does not support Objective-C Automatic Reference Counting
With that said, are there any specific instructions I need to follow for this to compile properly? Or maybe point me to the right direction?
Thanks!

This is Happening because here you are mixing the non-arc Code in ARC Code,that's why this error is coming.You can use below idea of mine and it works fine , have used the same in past
.
Hey You can Disable ARC for JSON classes by just set a flag in under the Build Phases of App setting.
and the flag is
-fno-objc-arc
As Below Image depicts the Way how to do this.
It would work with charm..!!!!

Related

Reference to ' ' is ambigous error in Xcode

I was working with a custom iOS framework project in Xcode.There I am getting a lot of errors mentioning "Reference to ' ' is ambigous".I am attaching the screenshot of errors.Please help me correcting this.
Adding more information to Jason's answer.
The error message makes me think you have two declarations of the same library functions. All of those references are from UIKit
mostly this can be occurring because of the header files. As you can see all the errors indicates that it is quoting the enum values. Enum values will always be in the .h files. Normally the reference headers(.h files) will be present inside the frameworks. It is a common mistake that sometimes these header files will be buried some where in our code by any third party frameworks. So kindly check your third party libraries.
I did face this issue once and after searching everywhere i could not able to find the solution. The only thing solved my issue was
Opening a fresh project and importing my files into that project. Actually it really took me less than 10 minutes to move to a new project and immediately my xcode was happy. This is definitely worth a try.
Actually This error was cleared when I shift from iOS SDK 6.1 to 7.1(or any version higher that 6.1)
The error message makes me think you have two declarations of the same library functions. All of those references are from UIKit. Check to make sure only one version of UIKit is referenced in your project (check the frameworks), and make sure any libraries you have included are linking the same UIKit version as the rest of the app.
Steps to fix from here:
Clean the project
Delete everything inside
'~/Library/Developer/Xcode/DerivedData/ModuleCache/' (the button
inside the organizer window did not work for me)
Clean once more
Build project
from here: Reference to 'X' is ambiguous
Clean your project and rebuild again.If it don't work then create a new project
Set value of Enable Module (C and objective-c) to No

XCode 5 cannot find binaries

Since I started using CocoaPods, I've been having weird location related messages all the time, and some arch-related ones too.
I've been trying the whole day to figure out why it was happening, until I create a new Xcode project from scratch and realize the issue wasn't project-related all along.
Here's what's happening:
I always get those everywhere as well:
Not sure if related but I get those often too:
Anybody has those as well? What should I do?
Thanks!
I had to switch Build Active Architectures Only for debug to Yes and it let the build run.

I'm trying to implement GuiCocoa/Calendar into my project, which uses ARC

Here's the GitHub link: https://github.com/guicocoa/calendar
I went through the source code and I'm trying to make it "ARC friendly" for use in my project, but I'm not very well versed in ARC (however, I do with to continue using it), so can someone help me out?
Or maybe an easier solution -- is there a linker I can put into my project where it'll just leave that "folder" alone and I can go on my merry way? :)
THanks
rnc505
Use -fno-objc-arc for the individual files.
See Disable Automatic Reference Counting for Some Files and How can I disable ARC for a single file in a project?
I did this for some libraries that I was using and came back after months of using ARC and cleaned them up myself. You really don't want to do it before you understand ARC well, so your instinct is right on.
Or you could go and convert the project to ARC. I forked it on GitHub and did it. I need a project like this so thought it'd be useful for me anyway. Here's my fork:
https://github.com/mattjgalloway/calendar

Issue in converting old objective C code into ARC (Automatic Reference Count)

I am trying to convert previously objective C code which is without ARC into ARC. I am fallowing the procedure like in Xcode: File > Edit > Refactor > Convert to ARC.
But I am not able to convert it, because it's generating lots of errors. I searched about this; I am trying to change the build settings in Xcode Target.
The Convert to ARC tool is not a magic bullet that makes your project suddenly ARC ready. What the tool is does is remove all of your calls to things like release & retain, it can also take care of switching some autorelease pools to the new #auto release {} style.
Before it does any of this it runs a pre-flight script to look for stuff that is too complicated for it to figure out and flags them as errors so you can go through each one and make the correct fix.
You need to step through each one of those 84 issues and figure out the solution to each one. Most likely there are half a dozen or so kinds of errors that are in multiple places but each occurrence may have a slightly different solution. Xcode may suggest a few possible fixes for some of the errors (any of the errors that show a stop sign with a white square in it have possible fixes, Xcode just doesn't know which one to use so you need to pick). Some of the issues will be easily solvable with a little help from Google. There will also likely be more errors than that in the end (I converted one project over that each time I fixed errors and tried to convert it reported more).
For the errors that you can't figure out after doing some research you should post questions about here, make sure to be specific as there are many possible things that could cause issues when converting to ARC.

Is there a way to mix MonoTouch and Objective-C?

I'd like to know if there is a way to mix C# and Obj-C code in one project. Specifically, I'd like to use Cocos2D for my UI in Obj-C and call some MonoTouch C#-Library that does some computations and get some values back. Is there a way to do this? Or maybe the other way around, i. e. building in MonoTouch and calling Cocos2D-functions?
Thanks.
The setup that you describe is possible, but the pipeline is not as smooth as it is when you do your entire project in MonoTouch. This is in fact how we bootstrapped MonoTouch: we took an existing Objective-C sample and we then replaced the bits one by one with managed code.
We dropped those samples as they bitrot.
But you can still get this done, use the mtouch's --xcode command line option to generate a sample program for you, and then copy the bits that you want from the generated template.m into your main.m. Customize the components that you want, and just start the XCode project from there.
During your development cycle, you will continue to use mtouch --xcode
Re: unknown (google):
We actually did this as described.
See this page for a quick start, but the last code segment on that page is wrong, because it's omitting the "--xcode"-parameter.
http://monotouch.net/Documentation/XCode
What you have to do to embed your Mono-EXE/DLL into an Objective-C program is to compile your source with SharpDevelop, then run mtouch with these parameters:
/Developer/MonoTouch/usr/bin/mtouch --linksdkonly --xcode=output_dir MyMonoAssembly.exe
This only works with the full version of MonoTouch. The trial does not allow to use the "--xcode"-argument . The "--linksdkonly"-argument is needed if you want mtouch to keep unreferenced classes in the compiled output, otherwise it strips unused code.
Then mtouch compiles your assembly into native ARM-code (file extension .s) and also generates a XCode template which loads the Mono-Runtime and your code inside the XCode/ObjC-program. You can now use this template right away and include your Obj-C-code or extract the runtime loading code from the "main.m"-file and insert it into your existing XCode-project. If you use an existing project you also have to copy all .exe/.dll/.s files from the xcode-output-dir that mtouch made.
Now you have your Mono-Runtime and assembly loaded in an XCode-project. To communicate with your assembly, you have to use the Mono-Embedding-API (not part of MonoTouch, but Mono). These are C-style API calls. For a good introduction see this page.
Also the Mono-Embedding-API documentation might be helpful.
What you have to do now in your Obj-C-code is to make Embedding-API calls. These steps might involve: Get the application domain, get the assembly, get the image of the assembly, locate the class you want to use, instantiate an object from that class, find methods in class, call methods on object, encapsulate method arguments in C-arrays and pass them to the method-call, get and extract method return values.
There are examples for this on the embedding-api-doc-page above.
You just have to be careful with memory consumption of your library, as the mono runtime takes some memory as well.
So this is the way from Obj-C to C#. If you want to make calls from C#/Mono into your Obj-C-program, you have to use the MonoTouch-bindings, which are described here.
You could also use pure C-method calls from the embedding/P/Invoke-API.
Hope this gets you started.
Over the weekend it emerged that someone has been porting Cocos2D to .NET, so you could also do the whole work on .NET:
http://github.com/city41/CocosNet
Cocos2D started as a Python project, that later got ported to Objective-C, and now there is an active effort to bring it to C#. It is not finished, but the author is accepting patches and might be a better way forward.
Calling Objective-C from MonoTouch definitely looks possible. See the Objective-C selector examples
What library are you calling? Perhaps there's an Objective-C equivalent.