Does anyone know where I can get the class files for iOS XML-RPC that works with enabled ARC? So far I can't build by project because arc raises all kinds of exceptions.
Found that you can compile sources with the
-fno-objc-arc
flag. this makes a file with the flag compile without ARC.
Related
I'm trying to compile a dependent libraries from the source code and I've got this error:
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/usr/include/unistd.h:446:8:
note: 'fork' has been explicitly marked unavailable here pid_t
fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
Is there any way to resolve this issue?
The thing is that I don't actually even need this functionality. When I compile this code for iOS and run it under tvOS then it works.
But I can not submit the application because it contains code compiled for iOS.
What would be the good trick to substitute there a dummy fork() function so it compiles OK (believing that it is not actually used by my specific use-cases).
I don't believe there is a way round this. You cannot create processes under iOS and tvOS is 90% iOS, so the same restriction applies.
You'll have to conditionally compile-out that section of code for iOS/tvOS.
I try to import a non-arc library(ASIHTTPRequest) to project.
but it reports arc error.
Is there a way to import a non-arc library to arc project?
Your comment welcome
Yes, It is possible to disable ARC for individual files by adding the -fno-objc-arc compiler flag for those files.
You have to add non arc flag -fno-objc-arc in all ASIHttpRequest Classes in ProjectSettings->BuildPhases->Compile Sources
ARC can be disabled on a ASIHTTPRequest files by file basis with the fno-objc-arc flag.
Set the no-objc-arc flag at path ProjectSettings->BuildPhases->Compile Sources->ASIHTTPRequest .m files.
But it is better to use AFNetworking classes for HTTP request handling now.
AFNetworking is best on now days, whereas ASIHTTPRequest is pretty much dead. Additionally, AFNetworking has dozens of great helper libraries and classes available for handling things like OAuth, Amazon S3, and the like.
AFNetworking also available for ARC support.No need to set flag.
I have a project previously built in iOS 4.3. When I tried to invoke the “ARC” conversion tool with
Edit > Refactor > Convert to Objective-C ARC
from XCode 4.5.2, the tool reports many errors. Some are supposed to be modified automatically by itself, for example the keywords autorelease/release/retain should not be used.
The errors seem too many (1,987 occurrences) to resolve by hand. Are there any configuration options that i am missing or should something else be done?
If you are using existing libraries you can simply not use ARC for those libraries and begin using it throughout your app by using a flag.
Add this to your library or files in question to ignore ARC
-fno-objc-arc
i think you have used any third party libraries, if you have used any third party libraries then it won't helps you.that means in this situation it wont automatically converts it to ARC.
Unfortunately ARC manages memory only for objective-c objects, if you have used any C or C++ files then in this case you have to handle memory management yourself
I am creating a static framework and will be using it across multiple applications. In the framework code I have disable ARC flag and is set to NO.
Other projects where I will use the framework may have ARC set to YES or NO. So if there is mismatch in ARC flags in Framework and the project where the framework is used, the application crashes since it tries to deallocate something which is already de-allocated.
Is there a solution to the above issue?
Regards,
Nirav
ARC is a compile time setting, so it is per-file not per-application. All you have to do is make sure your code in each file agrees with the compiler about if it's using ARC. If you want to throw an error if a file isn't using ARC when it should be, use something like:
#if !__has_feature(objc_arc)
#error This file should be compiled with ARC enabled
#endif
and similarly for detecting the opposite.
I just cloned the git repository for the SBJson framework and imported the source code into my application. Ran a Static Memory profiler and got a little scared from the results I saw.
See the picture
How is this possible? I doubt the developer of this very well known library didn't see this? And indeed, if a run a memory profile it shows memory leaks from this library.
Any ideas?
Thx
It looks like you're using SBJSON in a project that doesn't have ARC enabled. Since ARC removes the need to call release explicitly, code written for ARC (like SBJSON) causes memory leaks when used in a non-ARC project. You should convert your project to use ARC with the built-in refactoring tool (Edit > Refactor > Convert to Objective-C ARC, then explicitly set the -fno-objc-arc compiler flag on any of your source that is not yet ARC-ready.