I have old project that uses manual memory management. My new projects are using ARC. How can I convert my old project to use ARC as well?
Yes, you are on the right track: Your new project uses ARC (automatic reference counting). There is a lot of information available on Stackoverflow and other sites on how you can migrate to ARC.
However, you can also tell Xcode to not use ARC for individual files. Just add the -fno-objc-arc flag in Build Phases - Compile Sources. (There, you can add a flag to a file by double-clicking the file.)
Related
I have a project that is mostly Swift, but has some (internal) Objective-C code wrapping around CommonCrypto functions. It took some some tinkering, but we managed to make it work without exposing the internals by making all the headers private and using a bridging header, not added to any target but referenced in build setting "Objective-C Bridging Header" (on the targets, not the project).
Now we decided to move this part of the project into its own framework. So I created a new project (as Cocoa Touch Framework, same as the old), copied over the necessary source files, recreated the bridging header, and expected it to compile.
However, I'm getting
error: using bridging headers with framework targets is unsupported
This is confusing since there is one in the other project, which builds just fine (for iOS and macOS).
I went through all of the build settings, project and target. The only differences are
iOS target version 10.3 (new) vs 10.2 (old),
no signing vs signing (that may just be because the new project never built), and
some static analysis setting about suspicious conversions.
Neither of those should impact this matter. Nevertheless, I confirmed that the new project doesn't build for 10.2, either.
So what's going on here?
I am using Swift libraries in Objective-C Project with CocoaPods.
I tried running them in the recently released Xcode 8 GM and I am getting the following error:
I tried all the solutions in the below link and also from other SO Answers but nothing seems to work.
http://www.ios-blog.co.uk/tutorials/xcode/quick-tip-fix-use-legacy-swift-issue-in-xcode-8-beta-3/
Libraries I am using are Charts and XLPagerStrip.
You need to update your "Pods" project. For each Pod, choose the target and set it to use the legacy compiler. Note that if you do a "pod install" later, the workspace that gets generated will overwrite the legacy compiler settings, so you have to redo them.
This question will be easy for Xcode pros but for a MonoTouch developer it seems to be impossible to resolve. :-)
I'm using Xcode 4.5 and I want to target iOS 5.1 and above and iOS Simulator 5.1 and above.
I have a a library project here and it is coming with a prebuilt binary named "DemoLib" (no extension and it is 11MB in size). The library is a fat lib for Simulator and iOS 5.1+.
I can use that library without any problem.
However if I try to build the library myself, I end up with a "DemoLib.a" file (notice the extension and the size of 30MB). How can I get the same build result? What is a .a file compared to the file without extension?
I tried to build the project "for running", and "for archiving" in Xcode. Both results in the same 30MB .a file.
I was expecting some dropdown in Xcode where one could select "DEBUG" or "RELEASE" build and the latter one would create the smaller lib.
Of course I could never tell without seeing the framework's project file. Having said that, there is an excellent guide to creating and compiling iOS frameworks here: https://github.com/jverkoey/iOS-Framework
Using the above guide, you should be able to recreate your framework's project from scratch, add the files you have to it, and properly compile it.
Hope this helps! :)
Did it come with a Makefile? Create a new target, set the build settings of the target to what's in the Makefile, then set your project to depend on that new target.
A file with the .a is a static library, which means it depends on nothing external and all the code it needs is compiled inside it. I think no extension generally implies dynamic library, which means it'll depend on some dependencies being present on your system to link against. Maybe that's why the .a is so much bigger. I think Xcode will build static by default because iOS does not allow the use of dynamic libraries.
The dropdown for what to build is in your scheme. Command+shift+< to view your scheme. Within the scheme you can edit which environment each method of building will use.
I want to download AFNetwoking's older version without arc please guide.
If you do not use ARC in your project you can add the -fobjc-arc flag to all the AFNetworking source files to compile only those under ARC. You can set these flags in the "Compile Sources" part of the Build Phases tab in the project settings.
You can also go to the GitHub tags and download version 0.10.1.
I'm creating a modular open-source library. Let's say the project has 15 .m files in it.
Should I (1) release it like the Venmo iOS SDK (Cocoa Touch Static Library) or (2) release it like JSONKit (just the source code)?
Releasing as source code means you, and your developers, don't have problems when a new architecture comes out. A static library built as armv6 wouldn't work with the latest Xcode today.
One caveat with source code releases, since you don't know what build settings the project it's added to will have, you'll need to do extra work to make sure it builds without warnings as best you can, even for pedantic warnings.
I prefer frameworks over static libs. Its easier to ship resources in the framework bundle if you eventually need to and there no cost to dynamic linking. If its pure C and the libraries dependencies are guaranteed to be there then it might be ok. But in general I try to avoid static linking unless I know the target OS has the exact dependencies for that binary at deployment time.
Its much easier to load a dynamic library with the endpoints you need at runtime (which were compiled for that exact platform but have the same external interface) than it is to fail with a static lib that was compiled directly to external dependencies which dont exist on the target platform.
Maybe Im crazy but this is what Ive always done in C, C++ or obj C. Just my opinion.
http://en.wikipedia.org/wiki/Static_library