I have two questions basically.
Scenario is that I have a(n) NMI Payment Gateway SDK
the SDK or library won't work under simulator environment. Though it is logically right since the sdk is for reading mag data I can't test other parts of my app on a simulator ( And I have limited resource on device ). Is there a way to recompile the sdk or based on my research how can I create a static library so that I can generate a i386 architecture based sdk. Or better yet is there a way that I can check if environment is i386 then don't load the sdk?
I tried creating a(n) app using the SDK mentioned above. I would like to run it using an iPhone5s device and arch (armv64, armv7 and armv7s) but it says 'undefined symbols for armv7'. Would there be a way to somehow recompile the sdk and enable it to run on newer architecture?
Any help is much appreciated. THANKS
We use different targets for simulator and for device, and in code use macro TARGET_IPHONE_SIMULATOR.
example:
#if (TARGET_IPHONE_SIMULATOR)
NSLog(#"device");
#else
NSLog(#"simulator");
#endif
Related
I am trying to integrate Google cast SDK but not working in Apple M1 Pro chipset.
pod 'google-cast-sdk'
I am tried with every possibilities but not worked well and it's throwing as error like attached image. Any idea to get rid of this error.
Any help more appreciated.
Thanks in Advance
The Google Cast SDK you integrate with CocoaPods contains a binary framework which currently does not contain the arm64 simulator binaries, thus the linker error you experience when building the project for the arm64 simulator.
arm64 simulator binaries are namely different from arm64 device binaries, as this excellent article series explains in great detail. An XCFramework is needed instead so that both the arm64 device and simulator slices can coexist in the same package, thus addressing all possible build scenarios.
Google engineers are currently working on this known issue and a proper XCFramework should be delivered early January 2022 for version 4.7 of the Google Cast SDK. Though this is not mentioned explicitly I hope they will update the pod accordingly at the same time.
At the time of this writing (early January 2022) this XCFramework should be around the corner, so I would recommend working with the x64 simulator or an arm64 device in the meantime if you can.
If you cannot afford this compromise you can transform arm64 device binaries into arm64 simulator binaries. The article series listed above describes how this can be achived both for static as well as dynamic binaries, as Google Cast provides its SDK in both flavors.
Can try. Target > Build Settings > Architectures > Excluded Architectures > Debug > add "arm64"
I have a doubt, when we set target device and build a normal working project then it builds success, but same project when I change target to simulator OR Generic iOS Device then it fails. I have shared screen shot for error details when I build a working project on simulator. What's the reason behind this why same code builds + runs perfectly on iphone devices OR Generic iOS Device, On the other hand fails on simulator? Please note that, I have added already necessary Framework in my project. Any suggestion will be great. Thanks guys.
http://i.stack.imgur.com/CJTim.png
it means the supporting frameworks are missed
for _OBJC_CLASS_$_SKStoreProductViewController
add StoreKit framework
for _OBJC_CLASS_$_asidentifiermanager
add AdSupport.framework
for _OBJC_CLASS_$_CMMotionManager
add
CoreMotion.framework
Whenever you encounter such issue, I recommend on using the 'lipo' tool of Apple. you call it like this:
/usr/bin/lipo -i <path-to-libraray-file>.a
The response will be:
Architectures in the fat file: <the-lib>.a are: armv7 arm64
I guess that in your case, the library which provides the ASIdentifierManager will only show armv7 and arm64 which are required to run on real devices, but not i386 required for the simulator.
So the question is where this library is coming from. If you got it from a 3rd party, ask them to provide a 'fat' library which include all the required architectures, including one for i386
Your mac (simulator) running on i386 architecture. If you compile your static libraries for i386 as well you will be able to use them on the simulator.
Try adding "i386" to the "Valid Architectures"
I am working on a iOS app that uses a commercial static library (.a) which is compiled for armv7 architecture. This works fine but it does not work on iOS 9 because Apple requires that all libs should support arm64.
Until now the vendor of this library will not deliver me a arm64 version of this library.
I've googled this a lot lately but cannot find a solution or workaround to make this work.
Many posts also on stackoverflow say this will not work.
I've tried, as some posts say, to add -Wl,-segalign,4000 to the other linker flags in the build settings of XCode in the target of my project but it did not work.
So this probably will not work, but I was wondering does anyone know a solution/workaround so that my app with this static library will work on iOS 9?
Thanks in advance.
As you have ascertained there is no solution here other than obtaining a 64-bit library from the vendor. I am in the same boat with an internal application I own that leverages a vendor's (antiquated) framework that is based on armv7. Until you get your hands on a 64-bit version of that library you are dead in the water.
I have an iPad app that relies on the Google Maps iOS SDK. The Google Maps SDK is added as a cocoapod and it does not compile for 'armv7s' architecture, so when I first created the project, I had removed "armv7s" as a valid architecture.
Now, when I try to build the app for iPad Air, I get the following:
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7s, VALID_ARCHS=armv7).
If I set "ONLY_ACTIVE_ARCH" to 'NO', cocoapods will have massive issues (all pods will have the "undefined symbol for architecture" problem). If I add "armv7s" as a valid arch, Google Maps won't build. I know it's possible to use Google Maps on an iPad Air, but I can't figure it out. What do I have to change in my setup?
According to this closely related question, the Google Maps SDK now has support for armv7s and if you pick up the latest version (which is 1.6.1 as I type this), you should be just fine.
I would assume that with "armv7s" support in both the SDK and in your own code, you can keep "ONLY_ACTIVE_ARCH" set to "YES" going forward.
I have an SDK to achieve some special stream of video but I've got only the binary of this, I think this was built for arm7.
I have an app built with this library and it runs great on iPhone 4, 4s and iPad 2 but when building for iPad 4th generation with an arm7s xcode shows lots of errors about files being ignored.
I'm pretty sure it's the architecture cause changing the build architecture the errors appear and disappear.
Is there any way to make this work? I mean build for new architectures having only binaries files of the old one?
Unfortunately not. To build your app for armv7s all the code – which includes said library – has to be built for it. There is a hack to add armv7s support to static libraries but I would strongly recommend against using it.
That being said, for now it's not a big deal if you're building your app for armv7 only. It will still work fine on the iPhone 5.
Just go into the build settings of your Target and set "armv7" as the only architecture your app should be built for.
At one point in the future Apple will probably require that all new apps / app updates will be built for armv7s, like the did with armv7 a few years ago, but for now it's not a problem. By then the developer of the static library will hopefully have provided an update.