Making calls to a static library crashes my iOS simulator - ios

Since making the transition to XCode 4.5 and building with iOS 6 SDK my app crashes every time I make a call to a third party framework or static library .a file. Initially when I made the transition to XCode 4.5 these frameworks worked. The issue started popping up as I began updating the frameworks. After deleting the old version of the framework and adding the new one I would begin getting the crash on my simulator.
Running the code on the device works fine as expected but as soon as I make a call to any one of my third party frameworks or static libs on the simulator I'm doomed. Some of the frameworks that cause a crash are the Parse Framework, Socialize. The errors
Has anybody experienced this or hopefully found a solution? Testing on the device is slower but the real bummer is that I can't run any unit tests on my app.
Thanks,

Since you said you updated the frameworks or static libraries:
Are you sure that the APIs of these frameworks/libraries did not change in the meantime?
Are you sure you added the frameworks in the "Link Binary With Libraries" again in your Build Phases of your application project, to link your app with the fmk/libs?
Also be sure that the -ObjC flag is still present in your application's "Other Linker Flags" build settings, even if there is no reason not to if you had it already (as it worked before).
Besides, what is the crash log and error message when you call these methods?

Related

Bitcode issue when building a Universal (FAT) iOS Framework which has external dependancies integrated via a podspec

My goal is to build a universal framework that can be use in iOS devices and simulators. I want to be able to distribute this framework using cocoapods which also I was able to do successfully.
My framework has some external dependancies, the main one being AWSLambda which I included in my podspec which seems to give me the issue.
I was able to build and embed my framework into a test project by manually dragging the framework into the test project or by installing it via cocoa pods. On both occasions, running the project on a device or a simulator had no issues and everything worked fine.
However, when I tried to archive the test project to submit it to TestFlight, the process failed with the key warning being FrameworkName was built without full bitcode.
A popular solution which came up is to set enable bitcode to no, however I don't think this is the right solution for this project at least as I am building a Framework which will be integrated into other projects and asking client applications to disable bitcode does not seem the right way to go. If it was a personal app I may have taken this route.
So to resolve this, I took some help from stackoverflow and here is what I tried
This stackoverflow answer first
In Build Settings of the framework project set Other C Flags to -fembed-bitcode
In the Build Settings of the framework target add a user defined flag called BITCODE_GENERATION_MODE with the value of bitcode
Both in the framework project and target, Enable Bitcode should be set on Yes
Similar answers were repeated here which I tried.
Here is another answer which I tried where the person recommends to set Skips Install to No and archive the framework instead of building it.
While trying this standalone or in combination, the building of my framework still fails however, this time it is not referring to my Framework but it is referring to my pod dependency AWSLambda.
Adding this to the podfile seems to solve the problem of building the framework, however again I am faced with the challenge of asking the user's to include this into their podfiles which does not strike me as professional or I could be wrong ?
I wanted to know what were my options when it came to such errors with dependancies and is there any way to overcome this ?
I am not sure if such things can be added to the podspec to overcome these challenges.
I probably will have to make a compromise somewhere but it would be nice to get some advice on how to solve this issue.
Thanks

XCode creating half-sized static library

This issue is driving me nuts. I am asking it here before I announce it as a bug in XCode and try to use another version of XCode.
So, I am using XCode 8.3.2. I have a project that generates a static library. I am moving the .a file to another project and I use it (I know I can integrate the static library project in the second project but I don't want that here).
The file generated is 4.4MB. After copying the newly created .a and I copy it to the second project and test it, everything works fine. But when I come back to the library project and build it, the generated file is 2.3MB with missing symbols!!!
I cannot make it work unless I restart my MAC, or XCode somehow crashes.
What I have tried : Clean project, clean folder, delete Derived data, added -all_load -force_load -ObjC flags in my target linker flags.
If anyone has any idea about what is happening, please inform me.
Thanks!
It depends upon the target device you have selected during building your library. In Xcode, When you select any specific simulator or device, that time Xcode only creates single slice or thin product.
If you select Generic iOS device , means no device or simulator, that time Xcode create library having all the device slices and one folder having Simulator slice.
By using LIPO command you can put simulator and device slices together.
In your case, during first and second time, You are changing the device target from Generic iOS Device to specific device.

App builds for Simulator, but not for 'Generic iOS Device'

I am experimenting with pulling data from the internet for my app, and everything works as it should when the app is run in the iOS Simulator or on my own device.
The frameworks I'm using are Alamofire, SwiftyJSON and GzipSwift; I cloned the Github repo of the Gzip framework, build it myself, dragged the .framework into my project navigator and linked it up (added the framework to Link Binary with Libraries under Build Phases).
Now, when I build the code for any specific device, it compiles and runs just fine, but when I select 'Generic iOS Device' as the target, the build process fails and tells me that it couldn't find the methods I used from the Gzip framework.
I am quite certain I missed some setting or didn't import the framework correctly, but I have no clue on how to fix this.
Any ideas?
I guess you build the framework only with the simulator architecture instead of building it for all architectures (arm64).

Other linker flags -ObjC crashes my app when adding Stackmob SDK

I am trying to add Stackmob SDK to an existing app and it crashes right after the app launches with EXC_BAD_ACCESS. The SDK works fine with any new project, but crashes my existing code. Adding the SDK consists of adding the actual SDK folder, adding frameworks, editing pch header file and adding -ObjC value for Other linker flags in Build settings.
The last step actually makes the app crashing. I am not sure if the SDK conflicts with any other library. I use SBJSON and 2 small helper classes beyond my own code. It's iPhone only, iOS 7.0.3, Xcode 5.0.2. Any idea what may cause the issue or how to adjust my settings? Thank you.

Xcode 4.6 doesn't recognize linked frameworks correctly for Xcode 5.0 created project

I've created a project in Xcode 5.0 (yes, Developer Preview) for the beta iOS7 software because I wanted to play around with the new beta stuff. But I actually decided to submit the App I was playing around with to the App Store and since this is not possible with preview Xcode versions I fixed all compatibility issues to make the code work with Xcode 4.6.3 and iOS 6. Except for one thing.
And that's importing third party frameworks like Flurry (analytics framework) or Crashlytics (crash reporting framework).
Both are correctly imported and set up with targets (it's all working in Xcode 5.0) but I'm getting a 'Crashlytics/Crashlytics.h' file not found in the line I'm importing the needed classes (#import <Crashlytics/Crashlytics.h>) in Xcode 4.6.
The same is true for the Flurry framework analogously. The crazy thing is, both libraries show up in the targets 'Link Binary With Libraries' list, even in Xcode 4.6.
Does anyone have an idea how I can get things work in Xcode 4.6? Are there any further ways to influence the importing?
The link binary with libraries is not the issue here. You have to confirm your Header Search Paths in your build settings. I think Xcode 5 might use a different variable for it, and that is why Xcode 4.6 will get confused (just a guess though). Anyway, confirm that the path to those headers is in your Header Search Path. The Crashlytics app will automatically add it for you, actually.

Resources