When i created my project, i made it to support ARC, so my project will support iOS 4.3 and above.
Now i need to integrate Twitter and Facebook to it. Both Facebook and Twitter frameworks given by the companies does not support ARC.
Most of the files have dealloc, and released its variables. Some say to scrap the project and redo it disabling ARC. But, i can't afford to do this, since i have done most of the stuff.
I added the FBConnect files (there were 4 of them) and added -fno-objc-arc as described in this tutorial. Still i get
file://localhost/Users/illepmorgan/Documents/Projects/illep/untitled%20folder/alphaproject/alphaproject/FBRequest.m: error: Automatic Reference Counting Issue: Existing ivar '_delegate' for unsafe_unretained property 'delegate' must be __unsafe_unretained
I need help, i can't redo this again.
Make sure that you added the -fno-objc-arc flag to each implementation file (.m file).
And then clean the project (Project menu -> clean) and build again. I have sometimes had to clean and build twice when doing this in class. Seems like a little bug.
there is actually a much easy way working in mixed ARC and Facebook none ARC .
see my post on how to use it
http://nabtech.wordpress.com/2012/02/02/facebook-ios-sdk-and-arc/
Related
I've added all of the files and the frameworks needed to run the Admob SDK, but the problem is ARC...
My project uses ARC, but the AdMob files don't use ARC. I know you can disable ARC on specific files via the "Compile Sources" section which is under your project menu -> Targets (App Name) -> Build Phases
The problem is that the AdMob files don't show up in the Compile Sources section or any other section. You can see my AdMob folder in the Project Navigator...
Why won't these files show up so I can disable ARC on them?
Looks like you're not compiling Admob .m files, but rather it's a library you've included in your project and you're just using the .h files for the interfaces. So you might not need to worry about ARC v non-ARC issue at all. You can frequently use non-ARC libraries in ARC projects. The main issue is whether the library conforms to the rules outlined in Transitioning to ARC, such as the standard naming conventions, where the only methods that return an object with a +1 retainCount begin with alloc, new, copy, and mutableCopy.
You only need the -fno-objc-arc option if you're compiling the library's source in your project.
I'm new to iOS and trying to use RestKit.
I'm getting a 'sigabrt' exception during Singleton instantiation dealing with the use of autoRelease.
I noticed that RestKit uses memory management keywords that are not allowed in iOS projects w/ Automatic Reference Counting (ARC) enabled, could this be an issue?
Anyone encountered anything similar?
I'm surprised you were able to get the project to compile with those keywords.
You will need to use the linker flag -fno-objc-arc in the Compile Sources section of your Build Settings for all RestKit files, or include it as a project that does not use ARC (a much better approach).
Refer to the RestKit installation docs for help on this: https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x . Installing as a git submodule is the way to go imho.
You can easily add the library to a project that use automatic reference counting (ARC) by following the steps below.
Add the Rest kit files to your project.
Go to your project settings, select your application's target(s) and click the "Build Phases" tab.
Expand the section named "Compile Sources".
Select all the files from the RestKit library
Hit Enter to edit all the files at once, and in the floating text-box add the -fno-objc-arc compiler flag.
Thanks.
OK - found the problem: it seems the '-ObjC -all_load' key disappeared, I thoroughly followed RestKit's install instructions but this seemed to have slipped somehow - jshin thanks for making me look through the installation help again :)
Coming from .NET world I have to say XCode/ObjectiveC feel extremely archaic in comparison, just adding a library is a 10 page manual and not to mention the exception that made no sense what's so ever or gave any useful info - but then again this is coming from someone who's new to iOS :)
I have an Iphone app that used the excellent ABContactHelper library origionally written for by Erica Sedun and released on github
Now with the release of XCode4 and Reference Counting support, it causes lots of errors. I have looked at the forks on github, but none seem to have updated to XCode 4 with Reference Counting. I am trying to update it myself but its slow and error prone. I have tried the automatic refactoring support, but to no avail.
Does anyone know of an alternative AddressBook wrapper that provides a simple interface for interacting with the IPhone AddressBook?
In your ARC-enabled project, you can selectively disable ARC for the AddressBook wrapper files by setting the -fno-objc-arc compiler flag for those files.
Add compiler flags in Targets -> Build Phases -> Compile Sources. Enter the compiler flag by double-clicking on the right column of the row under Compiler Flags.
Dealing with ARC/non-ARC issues is a pain in the butt, and I've found that letting CocoaPods handle these problems for me is the way to go. Simply list ABContactHelper as a pod dependency and you're done. Many of the most popular libraries are already there, but if yours isn't, it's really easy to add it.
http://cocoapods.org
I'm trying to add Internet access to my application and in order to do this, I am testing to see whether or not the user is connected to a Wifi/3G network. To do this, I followed Apple's Reachability sample code and added Apple's Reachability.h and Reachability.m to my project. When I try to run the project at this point (I haven't even added any code accessing the Apple's Reachability files), I get 13 errors. This seems normal, as I have not yet added the SystemConfiguration framework to my project, but when I do add it, I still get the same errors, making me wonder if I'm adding frameworks correctly.
To add the framework, I went to...
Project > Targets > Build Phases > Link Binary with Libraries > The + Button > Add SystemConfiguration. Framework
Has anyone else had this issue and figured something out?
Images of Errors showing "Automatic Reference Counting Issue"
http://farm8.staticflickr.com/7034/6461498873_5faeae2db3_b.jpg
http://farm8.staticflickr.com/7017/6461499405_1e679067e2_b.jpg
These are ARC errors, your project appears to be set to use ARC but the Reachability classes are not written to support ARC, you will need to disable ARC for Reachability.m
See how to do that here, How can I disable ARC for a single file in a project?
I have an NSLog alternative that outputs the class it's called from as well as the line number and method (selector) called PLog in a class called PLogging. It's the exact same as the DLog taken from here with the exception of the name change. The advantage of DLog as it is written is that when compiled under Release mode, the log call is changed to a comment, negating the performance impact you would otherwise be subject to. I want to be able to use this and keep it within the framework, but be able to call it from the projects I add the framework to. But still have the log calls compiled to comments when in Release mode. Is this possible?
I would suggest a white list approach: add a preprocessor definition to your debug configurations which enables DLog/Plog to log to the console. In every other case it turns to comments.
Please have a look at this blog post which seems to point a finger at your problem. Of course, assuming that you don't want to change the way you are achieving your functionality: macros. I'm quoting abit: "An example of the basic problem is you want to link to a library that has both a Debug and a Release version. So in your application you want your Debug version to link to the Debug version of the library, and you want your Release version to link the Release version of the library."
I would rather tend to use targets for that, the trouble does look uncomfortable.
Third-party frameworks aren't allowed by the App Store. I assume you've got a static library or source files that you add to your apps with a cross-project reference?
If you've set your library project up with a debug flag set for your Debug configuration and unset for your Release configuration, then all you have to do is use the same configuration names for your app project, and the library will be built with the same configuration.