Problems getting Firebase set up in xcode - ios

Really having a tough time getting Firebase stood up in xcode. I'm trying to get a project going using Swift with the instructions here.
Per the instructions I create a new project using Templates. I choose Firebase > Single View Application, which creates a project. From here I have problems.
I try to create a bridging header by first creating a temp objc file. I'm never presented with the option to actually create the bridging header during that process. Only the objc file is created. I manually create a header file using these instructions.
I note some strangely name view controller files are created which fail the build due to containing multiple syntax errors (___VARIABLE_classPrefix:identifier___ViewController.h and ___VARIABLE_classPrefix:identifier___ViewController.m).
Main.storyboard won't open. I get a message saying it is corrupt.
What is going on here? I'm able to stand up a normal non-Firebase project via templates. I'm new to Swift/XCode dev so I'm not sure if I'm missing a step. Is it possible to install this SDK via templates?

Not quite sure what you've done here lol.
Best to use this guide when new to swift.
To create a header file go to 'file' -> 'new' -> 'file' -> In the IOS tab 'Header file'.
I've been having problems with Firebase in Xcode 8 Beta so probably best to stick with Xcode 7 until official release.

Related

Adding an Objective-C framework to a Swift XCode project

I know this is a very simple - maybe obvious - question, but I've been struggling with it for a while. I'm working on a SpriteKit project in XCode (using Swift) and I'm trying to add this SKEasing Framework from GitHub.
I've already downloaded and extracted the zip file, and I did everything that 孙博弘 answered including the bridging header (which I made the with the help of this site);
However, the framework doesn't seem to be working. I can't use any of the actions provided by this library. Is there something I'm missing? What am I doing wrong?
You don't add the project to your project.
First open the SKEasing project in xcode by itself. Set the build target to generic iOS device. (With the pop up in the top left corner of the xocde project window.) Then use the Build command (under Product) and when that's done run Archive. There should be a library built now under the products folder (left side of project window). Control click on the library name and select Show in Finder. This will lead you to the library. Copy this file to your project and you should be good to go.
if you use .a, you should use it as follow img.

How to create a custom Swift File template for Xcode 6?

I'd like to make a couple of Swift file templates that I can drop into Xcode's file template picker. I know how to make a custom Playground template and Obj-C file templates but for Swift there seems to be no file template available at all in the following path:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/Source/
This surely should be possible, shouldn't it? (Or does every app developer start with the awful default templates?)
I've created a new template folder under the path
/Users/name/Library/Developer/Xcode/Templates/File Templates/User Templates
with the name Swift File.xctemplate and the following contents:
___FILEBASENAME___.swift
TemplateIcon.png
TemplateIcon#2x.png
TemplateInfo.plist
and of course edited the files accordingly. When I open Xcode's temple chooser, my template appears but it somehow doesn't work correctly. It also opens a file browser and asks where to store the file which isn't right, and the file doesn't appear in the project afterwards.
Is there any solution to this? The web seems to be devoid of such information.
Using Xcode Version 6.1.1 (6A2008a), if you go into one of the template bundles found in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/Source you'll see the swift templates.
So, for example, let's open up a new Terminal window and look inside the Cocoa Touch Class.xctemplate bundle to see all the swift templates:
$ cd "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/Source/Cocoa Touch Class.xctemplate"
$ ls *Swift
NSObjectSwift:
___FILEBASENAME___.swift
...
That should give you a good place to start looking so you can figure out what has gone wrong with your custom template.
A couple things that always help me are:
1) Check, double check, and triple check your TemplateInfo.plist file, it's the most important file in the template and the easiest to mess up.
2) Sometimes, when I can't get Xcode to recognize my new template, or changes to an existing template, then restarting the dang thing sometimes works wonders.

New relic iOS framework, header not found

I am using New Relic in my iOS app. In my original xcode-project things work as expected. When I check out the project from Git on another computer (or the same computer at another location), I am unable to find NewRelic.h. I get the following error when I try to build:
'NewRelicAgent/NewRelic.h' file not found
The framework is added to Git, and I use several other third party frameworks that work without problem. If I remove the New Relic import the rest of the project work as expected. In the non-functioning version that I check out, I have even tried to remove New Relic and re-add the framework, but this produces the same error.
I have searched the project for any absolute search paths, but it seems like there are none. I would like some advice on how to make xcode find the file.
This actually looks like a problem with xcode. A few users found a very simple fix that's outlined here: Why are static library headers not found?
Should be as simple as renaming the folder that contains the .xcodeproject.
I had this error when following their install instructions and imported the framework in the precompiled header. When importing it in the app delegate (which they explicitly state you should NOT do with the new version) everything works. Might be something with XCode6.1. Don't know.

How to add AFNetworking to XCode app

I'm relatively new to XCode and iOS. My background for understanding how to add libraries/dependencies to a project is in the world of Java and Maven.
I need to add AFNetworking to my project and have been unable to do so successfully.
First, I tried going to my project -> Build Phases -> Link Binary With Libraries, clicking the "+" button, and then search for AFNetworking from the list. It wasn't in the list.
So, I figured I'd have to add it using the "Add Other..." option. Which means, of course, I'd need to download AFNetworking somehow. I'm not sure I was able to download it in the correct form -- it seems all I could get was the AFNetworking project itself, rather than a framework (if I understand correctly, frameworks are analogous to jars? Can you generate a framework by building an iOS project in a certain way?). I downloaded it from their GitHub page. (I also tried their "Getting Started" guide, but it had me using CocoaPods, which I couldn't get to work right and I'd rather avoid it for now.)
I've tried adding project files and folders from AFNetworking just to see if they worked (but of course they don't -- I think I need some sort of .framework file).
Bottom line: I can't seem to find a way to add AFNetworking to my project. How can I do it?
It sounds like you got the first part down, which is downloading it from the GitHub page.
When I follow this tutorial, it shows how they imported AFNetworking into their own sample project (that is, you'll see a "AFNetworking" group in the list of files and folders along the left side of your Xcode window).
Once AFNetworking is building along with the rest of your code in your project, you should be able to call into the various AFNetworking API's from your code. You'll need to make certain to add in the appropriate "#import "AFNetworking.h"" lines into your source code files from which you'll be calling AFNetworking.
Use pods, than you wont have to upload AFNetworking to your github project, and there is no worry about wrong linkers etc.
Use pods: install pods
Instalation AFNetworkign with pods: install AFNetworking
I believe if you download their code you can generate the .a file using the process in this stack overflow answer: (obviously replacing the project they are getting from gihut with the project you found)
How to create framework from Xcode 4 project?
Use this Manager to help you use AFNetwork.

Xcode imports RestKit.h correctly in two files, but not into another file in the same bundle

I am having trouble making sense of what is going on here. I have a project using the Restkit Framework Library. The project was setup using Pods to install the framework and generate a workspace file.
I have three classes that are using RestKit.h, two of them (my app delegate, and my ViewController) import correctly, while a new file (a new ViewController) gives a red error on the import statement saying RestKit/RestKit.h file not found. Then when I try to use RestKit, I do not get code completion from xcode. However, the project builds and runs correctly after inserting RestKit Code.
Furthermore if I click "Jump To Definition" on the drop down menu when right-clicking a RestKit method in xcode, it takes me to RestKit source, implying that Xcode actually does know about the RestKit library.
Xcode version is 4.5.2
Any advice on where to look would be much appreciated.
Thanks

Resources