i am new in ios development and now days working on an app that has been designed in 32 bit architecture with lots of 3rd party apis and cocopods usage in it.
As apple has decided to move all the apps to 64-bit architecture, i'm unable to figure out if there's any api in my code that's not following the rules and is still in 32bit architecture.
is there any way to check that and to convert them for 64bit architecture support.???
You can use lipo -info to get the supported architectures. For example:
lipo -info mylib.a
Could give an output like:
Architectures in the fat file: mylib.a are: armv7 i386 x86_64 arm64
In this case, you see arm64, which is the 64-bit slice you want.
As far as upgrading your libraries, you'll need to rebuild the libraries yourself or download new versions with 64-bit support.
Related
Is there a way to convert a library that is built for macOS to a library that I can use in my iOS project. I'm getting an error in my app that follows:
/Users/edwardpizzurro/Desktop/LibreriasAlternativas/LibreriasAlternativas.xcodeproj Building for iOS, but the linked library 'libsndfile.a' was built for macOS.
In general, it's not possible and you have to rebuild your library specifying iOS architecture.
To get more info about your library, run
lipo -info libsndfile.a
It'll give you architectures like armv7 armv7s i386 x86_64 arm64. A default architecture for iOS is arm64, while for MacOS it's x86_64 (we are not speaking of new M1 hardware). So most probably for your libsndfile.a you'll get only x86_64.
This will mean you need to build libsndfile by yourself.
Here are releases of this lib, there's no arm64 here: https://github.com/libsndfile/libsndfile/releases
So you have to donwload the repo: https://github.com/libsndfile/libsndfile
And use smth like Autotools to build it for your desired architecture.
A rough example of what you'll have to do it here: Can't cross compile C library for arm (iOS)
While it's quite specific for each library.
I'am using zbar in my application. If I want to run it on my iPhone 5s with an 64 bit processor, I get the following errors:
Is it possible to use the 32 bit library on a 64 bit device, because I don't think, the library is going to be updated.
To summarize the comments above. A 64bit iPhone application requires all constituent libraries and frameworks to be 64bit. You can't mix and match. Leaving an application 32bit is non-optimal long term since iOS has to keep two versions of the system libraries loaded (32 and 64) as soon as a single 32bit app is run. Hence, you don't want to be the last app to support 64bit!
You can check if your library contains 64bit code using lipo. For example, here's the SBJson framework in 32bit:
$ lipo -info SBJson.framework/SBJson
Architectures in the fat file: SBJson.framework/SBJson are: armv6 armv7 i386
and with 64bit code
$ lipo -info SBJson.framework/SBJson
Architectures in the fat file: SBJson.framework/SBJson are: armv7 armv7s i386 x86_64 arm64
In the case of zbar, if it's not available you could always try compiling yourself from source.
Has anyone successfully created and used a module that implements a 64 bit (only) static library?
Here the situation:
Created a new Appcelerator module project
Downloaded the latest HockeySDK-iOS framework (64 bit only)
Integrated HockeyApp HockeySDK-iOS into my module project
build iOS module project no problem
build (package) appcelerator module no problem (build.py)
create new appcelerator ios App project 5.2.2GA
install module (.zip) into App project
#ERROR Building the app project...
ld: symbol(s) not found for architecture x86_64
The HockeySDK appear to only be built for 64 bit support. I played around with the Architecture flags in my module project - but the Appcelerator app build seems to require the i386 x86_64 architecture.
Or has anyone implemented a current version of HockeyApp SDK for ios?
Please do not suggest: https://github.com/timanrebel/HockeyApp as that project uses HockeyApp iOS SDK v3.8.5 while the current HockeyApp SDK version for iOS is 4.0
As my understanding, "the Appcelerator app build seems to require the i386 x86_64 architecture." means your application now config of supporting both i386 and x86_64 architecture. i386 is the architecture of your desktop that will be required if you want to run on simulator. But your HockeySDK-iOS framework (64 bit only) will not suppose to support i386 architecture. As my guess, you got that missing i386 architecture error while running on simulator. Could you try to config your project support 64 bit only and then run the project on your real 64 bit devices.
In order to fix that error, you can remove your i386 architecture support or download again to make sure that all libraries have been built for i386 architecture.
I have my project set up to run as 64-bit on supporting devices, and 32-bit otherwise. ZBarSDK is giving me an issue though. I get the error Undefined symbols for architecture x86_64.
Doing a lipo -info on the library file results in: armv6 armv7 i386
Is there a way to still compile my project for 64-bit and include this library?
No. 32-bit code cannot call 64-bit code and vice versa.
I'am using zbar in my application. If I want to run it on my iPhone 5s with an 64 bit processor, I get the following errors:
Is it possible to use the 32 bit library on a 64 bit device, because I don't think, the library is going to be updated.
To summarize the comments above. A 64bit iPhone application requires all constituent libraries and frameworks to be 64bit. You can't mix and match. Leaving an application 32bit is non-optimal long term since iOS has to keep two versions of the system libraries loaded (32 and 64) as soon as a single 32bit app is run. Hence, you don't want to be the last app to support 64bit!
You can check if your library contains 64bit code using lipo. For example, here's the SBJson framework in 32bit:
$ lipo -info SBJson.framework/SBJson
Architectures in the fat file: SBJson.framework/SBJson are: armv6 armv7 i386
and with 64bit code
$ lipo -info SBJson.framework/SBJson
Architectures in the fat file: SBJson.framework/SBJson are: armv7 armv7s i386 x86_64 arm64
In the case of zbar, if it's not available you could always try compiling yourself from source.