How Do I ' #import "Firebase.h ' in Xcode? - swift

I'm manually adding some Firebase SDK's in my iOS app and have been following Firebase's provided readme to the letter. As it directs, I've already dragged all the SDKs I need into my project but there's one step I'm not understanding. It reads:
8. Drag the Firebase.h header in this directory into your project. This will
allow you to #import "Firebase.h" and start using any Firebase SDKs that you
have.
I've added the Firebase.h header file into my project but I don't know how/where to add #import "Firebase.h". Since I haven't done that, building my app produces the error: No such module 'Firebase' when I try to import Firebase in my view controllers.
For reference, I had been using cocoapods for Firebase up until the recent iOS 13.3.1 update that broke my ability to test my app on my physical device, so I'm attempting to manually add the static Firebase SDK's in the hopes that I would then be able to continue debugging on my iPhone 6s. I'm 75% of the way through my app's development and have already fully integrated Firebase so this little switch-over from pods to static SDKs is definitely annoying, but it has to be done. I removed all the Firebase pods I was using in my Podfile and am just stuck at the step bolded above... hopefully it's a simple thing and then everything will work again as I already have it completely integrated throughout my app.
If you'd like a deeper background, here's a Stack Overflow question that describes the exact initial problem I was having with debugging on my physical device with the 13.3.1 iOS update.
And here's where I asked for alternative ways to incorporate Firebase that avoids pods (in case that fixes the issue). This is where I learned about Firebase's zip binary distribution. I downloaded the zip file with the Firebase SDKs, chose the ones I need, and have been following the readme to add them to my project.

To add Firebase module support, you also need to do the subsequent instruction in the zip distribution README after dragging Firebase.h:
9. If you're using Swift, or you want to use modules, drag module.modulemap into
your project and update your User Header Search Paths to contain the
directory that contains your module map.

Related

App Store not accepting my new app version written in React Native which was earlier written in Swift

I created an app using expo cli. I also created the build for the same using expo server and was trying to upload the app to the app store.
However, the previous version of the same app was written in Swift and I get this error.
As a result Apple is rejecting my app.
I have maintained the same bundle Id of the app.
Error :
Dear Developer,
We identified one or more issues with a recent submission for App Store review for your app, "My App Name". Please correct the following issues, then upload again.
ITMS-90433: Invalid Swift Support - The file libswiftAVFoundation.dylib doesn’t have the correct code signature. Make sure you’re using the correct signature, rebuild your app using the current public (GM) version of Xcode, and resubmit it. Don’t just modify the code signature of libswiftAVFoundation.dylib.
Best regards,
The App Store Team
I don't think that this solution works because when the application is built on Expo, using the command EAS, is the expo server who creates the IPA, and in one step copy the file libswiftCore.dylib (in my case) and is signing it using "codesign", then making changes in the local Xcode I don't expect solve this problem. ¿Maybe making some change that allows the project tell expo which signature must use in the swift support file?
thanks
solved by changing ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES in my project configuration.
In XCode select your project -> Build Settings and look for "Always embed swift standard libraries". If NO is selected, switch to YES (for debug and release), and it's done.
It is recommended to clean your build in Xcode before building and submitting again, just to make sure you have no residues of your old build left!
Solution 2:
The other solution I came across is the version mix match. Make sure you are using correct version of expo. Otherwise just update it to the latest one.

How to remove some of the Swift libraries copied by Xcode?

In Xcode 10, the "Copy Swift standard libraries" script is done last — after any custom build phases that may be added to the target. Hence it is not possible to create a custom build script to specifically remove Swift standard dylib files added by Xcode.
The question is, how to remove some of these standard libraries that are erroneously added by Xcode?
The reason behind it is that when Xcode 10 builds a Swift 4.2 macOS app that has a Photo Editing extension, it adds libswiftMapKit.dylib into the application bundle — even when the application does not have Maps functionality or import MapKit. This caused an App Review rejection.
To remove a Swift Standard Library, add a Post-Actions in the scheme. Most likely this would be an Archive post-action since archiving is typical prior to a release (upload to App Store or to re-sign using a Developer ID credential).
In Xcode 10 Click Edit Scheme.
In the scheme editing, expand the Archive section.
Click on Post-Actions
Enter the following bash script fragment (along with any other post-actions that you may already have)
# This variable points to the `Frameworks` folder of the final application.
full_frameworks_path="${ARCHIVE_PRODUCTS_PATH}/Applications/${FRAMEWORKS_FOLDER_PATH}"
# Specify the libraries to remove, the example below removes Swift's MapKit wrapper.
rm -f "${full_frameworks_path}/libswiftMapKit.dylib
However note that this does not solve the underlying problem of the Photos App Extension actually links to libswiftMapKit.dylib — a dependency added by Xcode 10.0 regardless whether it really uses MapKit or not.

iOS 6 - BluetoothManager framework - "NSObject" not found error

My question is a duplicate of this one. But that one (rightly)got closed as non constructive, with zero answer and with absolutely no use to anyone.
I am trying to connect to a external bluetooth accessory from my iPhone 5. The accessory is neither MFI certified nor support Bluetooth Low energy communication.
So my only option is to connect to it using a private Framework, and I am doing that since I am not intending to push my app to App store. The app is for personal use.
I am trying to use private BluetoothManager framework class, uses XCode 4.6 and my app is targeting iOS 6.0.
My current setup
Added a folder named Headers in bluetoothManager framework in sdk
folder
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/PrivateFrameworks/BluetoothManager.framework
Created 4 header files in that folder, namely
BluetoothAudioJack.h
BluetoothManager.h
BluetoothDevice.h
CTStructures.h
I got these header files from here.
Added BluetoothManager.framework to my project , using normal method
target->Build Phases->Link Binary with Libraries .
In my ViewController.h file, I imported the header file
#import "BluetoothManager.h"
This is it. Simply I am following this tutorial, but added the steps here just in case the tutorial went down.
My problem
I am yet to get into the coding part. When I tried to compile the above given setup, I am getting error
NSObject.h file not found
in the BluetoothManager.h file I added as header to the framework.
Any ideas?
Well I finally solved this problem. I just removed those
#import "NSObject.h"
calls from 3 header files which I mentioned in the question, and Voila!!

iPhone ARC & Facebook SDK

I'm getting all kinds of build errors with Facebook's SDK because my app uses ARC. I try to remove the Facebook files from the compiler to avoid this, but I get an Apple Mach-O error when I remove the Facebook.m file. If I put that back in the compile sources, I get the ARC errors.
Anyone run into this?
Do you exclude them from arc with Compiler flag
-fno-objc-arc
?
You can see a Answer here
And this is why distributing a shared library by copy and pasting files is bad. A library should be distributed as it's own Xcode projects with a static library target, so that the build setting requirements of your projects and the libraries you use can not screw up one or the other.
File a bug for the Facebook SDK here: https://github.com/facebook/facebook-ios-sdk/issues
And in the mean time add the -fno-objc-arc flag to the implementation files in the Facebook SDK. You can do this by;
Select your application target
Go to the Build Phases tab
Add for each file under the Compile Sources section.
The new SDK does not explicitly support ARC out of the box, but there is a shell scrip to build a static library that can be used within your ARC project. Just navigate to your local git repo and run
% ~/facebook-ios-sdk/scripts/build_facebook_ios_sdk_static_lib.sh
This will create the static library under the /lib/facebook-ios-sdk folder (e.g. ~/facebook-ios-sdk/lib/facebook-ios-sdk). You may then drag the facebook-ios-sdk folder into the app Xcode project to include the iOS Facebook SDK static library.
there are actually very few changes needed to make the Facebook iOS sdk compatible with ARC. I have made the changes in my code , but , I do not know who to send it back to the community, any pointers ?
here is a post I made to explain how to use it with ARC the simple way on Xcode 4.2:
http://nabtech.wordpress.com/2012/02/02/facebook-ios-sdk-and-arc/

Is a Dynamically Linked Framework possible on iOS?

The keyword here is possible. I know of a few resources that talk about this and how to create static frameworks - here: https://github.com/kstenerud/iOS-Universal-Framework and here: http://db-in.com/blog/2011/07/universal-framework-iphone-ios-2-0/
I'm interested to see if it's possible to create a dynamically linked framework in an app that will not be submitted to the app store. I know it's impossible to write to the application bundle on a device without jailbreaking it. Is it possible to say, download a compiled framework file, put it in the documents directory and then access it via the application (think plug-in architecture). I know that if it is, you would be turned away from the app store for submitting it, but let's say this was an enterprise app, or an ad-hoc distributed app where Apple would not have to approve.
In my initial research I haven't found anything supporting that it is possible, but I feel like this may be such a fringe case that no one has published anything about it. Looking for a guru to give me a definite "no" before I give up.
not sure if this is what you are after but according to Apple there dynamically linked libraries even usable in iOS - for example the system libraries... XCode contains copies of them and references them via symbolic links...
see near the end of this http://developer.apple.com/library/ios/#documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/iPhoneOSFrameworks/iPhoneOSFrameworks.html#//apple_ref/doc/uid/TP40007898-CH6-SW3
just an idea:
put the .dylib + include files you want to use into the respective folders where XCode expects the system libraries... use themn and then put symlinks into your bundle on deployment... let the symlinks point where ou copy the .dylib
I believe the answer is no. Apps on the iPhone are sandboxed. That is, aside from Apple supplied frameworks, an app cannot access anything outside of its own build.
This is possible now with IOS 8 Xcode 6.