How to install facebook pop manually? - ios

I want to use facebook pop, but I don't know how to embed it into my project. My project isn't workspace and no cocoapods, I just want to add them directly. Anybody help?

I just did this, so here are stepwise instructions. (Basically, expanding on the README which says: "By adding the project to your project and adding pop.embedded framework to the Embedded Binaries section on the General tab of your app's target, you can set up pop in seconds!")
Clone the library into a directory accessible from your app's project:
git clone https://github.com/facebook/pop.git
Open a Finder window into the newly cloned pop directory.
Drag the pop.xcodeproj file into your app's project navigator, inside your app's .xcodeproj.
Go to your app's project, select your target, select the General tab:
Under Embedded Binaries, add the Facebook pop framework. There are two on the list, one for iOS, the other for OS X. Because Xcode, the names are undifferentiated.
Verify you selected the correct one by looking at the path in the Embedded Binaries section after adding it.
Use the pop framework by adding an #import pop; to whatever view controller you want to use it in.

"... manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
Do you see that introduction?

Related

No such module 'SwiftCharts' Xcode Swift 4

I have created an app in Xcode and Swift 4 that uses the external frameworks 'SwiftCharts'.
All works fine, however if I move the folder where the whole project and all its files are contained, I get the error message "No such module 'SwiftCharts'" appear after every "import SwiftCharts" in my project.
I need to submit my project as a university assignment but at the moment the only place the project will work is in my Documents folder on my laptop.
You can check the module by Right click the SwiftCharts and check by Show in Finder.
If it is not present in the folder, you need to copy it in the projects.
I would recommend you read about Embedding Private Frameworks in Your Application Bundle:
you normally specify the full path to the appropriate frameworks
directory. When you embed a framework inside a bundle, however, the
location of the framework is not fixed, so you have to use the
#executable_path placeholder to let the framework know its location is
relative to the current executable.
Open an inspector for your framework target and select the Build tab.
Set the value of the Installation Directory build setting to
#executable_path/../Frameworks.
From this link:
https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880
Managing external references in any project is essential to understand.

Not able to access public swift class through framework

I created a project and imported it inside this framework. When i load this framework into a demo app, i am able to access the public class MyTest inside MyTest.swift file but not able to access the public class inside MessagesViewController.swift. Am i missing something? Can't we access files inside a project through a framework this way?
Restructure your project space so that you do not have your application inside your framework, then tackle linking files between the app and the framework.
Create a xcworkspace file to contain all of your sub-projects. For more information check out the Xcode Workspace section in the Xcode Concepts document
Open the workspace file and add your framework and app projects by dragging the xcodeproj files to the "Project Navigation" panel. Be careful when adding the files as Xcode as a tendency to place one project inside another, you don't want this.
Build your framework and then link it to the the app project. This will also make all you framework files available to your app project as long as they are public(see below for more details). Navigate to the FireChat-Swift app project target in the editor view then from the frameworks project open the product directory and drag the framework file to the Embedded Binaries section of the general tab.
Now your framework is linked with your app project. You will need to import your framework in your app's source code.
Add new files to your framework and remember they need to be public should you require them to be used outside of the framework - i.e. by your app.
Did you add MessagesViewController.swift to the Target inside the original Project?
To check it just open the original project, select MessagesViewController.swift and take a look at the right sidebar (Target Membership section).
I had this problem, and I fixed mine by going to my framework and adding target membership to Tests and UITests:
Strange fix, but I guess it works! 🤷‍♂️
This can also occur as part of a bug in Xcode, though I'm not sure what causes it - possibly dragging files from another project into your library. I just fixed this by closing down and restarting Xcode, then cleaning the build folder (hold down Alt then select the option from the Product menu).

Google API integration into xcode project

Add Files to "Quickstart"..., add the following projects to the workspace from the libraries you cloned in the previous step: google-api-objectivec-client/Source/GTL.xcodeproj
--> There isn't any GTL.codeproj, there is GTLCore.xcodeproj instead.
This makes it impossible to reproduce the following steps in the tutorial:
d- Select the "GTL" project's "GTLTouchStaticLib" target and make the following changes:
Add the library GTMSessionFetcher/libGTMSessionFetcherLib.a to Build Phases > Link Binary with Libraries.
e- Delete the "GTL" project's "GTLFramework" target.
f- In the Project navigator, delete GTL project's GTL Source > Common > HTTPFetcher group.
Check out the code. To do this, you can just run svn checkout
http://google-api-objectivec-client.googlecode.com/svn/trunk/
google-api-objectivec-client-read-only from your terminal. I will
refer to this code as "Google's code".
Go to your project's Build Phases. Expand "Link Binary With
Libraries" and add Security.framework and
SystemConfiguration.framework. These two are required by Google's
code.
Go to your project's Build Settings. Using the search box there,
look for Other Linker Flags (make sure "All" is selected to the left
of the search box). Add -ObjC -all_load.
Now search for User headers search path and add the full path to
Google's /Source directory. Make sure you select recursively.
Using Finder, go to Google's /Source/OAuth2/Touch directory. Drag
and drop GTMOAuth2ViewTouch.xib into your project.
Go back to Finder and go to Google's /Source directory. Drag and
drop GTLCommon_Sources.m and GTLCommon_Networking.m into your
project.
Now, you need to import the files for the services you want to use.
In my case, I need to use Google Drive, so I'll add those. In
finder, go to Google's /Source/Services/Drive/Generated directory.
Drag and drop GTLDrive.h and GTLDrive_Sources.m into your project.
If you want to use other services, go to their directory and import
the appropriate .h and .m file.
For some reason, Google's code doesn't use ARC, so if you try to
build right now, you will get ARC compile errors. So we need to
disable ARC for Google's code only. To do this, go back to your
project's Build Phases, but this time expand "Compile Sources". Make
sure that GTLCommon_Sources.m and GTLCommon_Networking.m are there.
Select them, press enter and type in -fno-objc-arc. This will
disable ARC for both of them. Make sure you don't add this option
for any other file (unless you know what you're doing).
You are done! Now, whenever you want to use Google's API, just
import GTMOAuth2ViewControllerTouch.h and your service header. In my
case, since I'm using Google Drive, I will also import GTLDrive.h.

Framework header file not found (iOS pop framework)

I'd like to install facebook's pop framework. I have a multi-project workspace which is not using cocoa pods. I want just the simplest, dumbest, quickest install.
From the pop readme:
"... you can add the project to your workspace and adopt the provided configuration files or manually copy the files under the pop subdirectory into your project. If installing manually, ensure the C++ standard library is also linked by including -lc++ to your project linker flags."
I added pop.xcodeproj to my workspace.
I added "pop.framework" to to
the project that needs pop (general > linked frameworks and libraries).
I added "-lc++" to my project linked flags (in the project that needs pop).
Added #import <POP/POP.h> to my .m file.
The result: "POP/POP.h" not found.
I guess I'm doing something wrong, but absolutely no idea where to start looking.
I set the Built Setting of my project, then it worked.
User Header Search Paths = $(SRCROOT) // recursive. Pop is placed in the directory
Always Search User Paths = YES
This setting worked for me:
in podfile:
pod 'pop'
in project > target > build settings
always search user paths YES
add search path:
Take a look at this:
How to add facebook open source code pop to project directly
I also discovered that the -lc++ flag actually caused a linker error. I followed the instructions in that link and removed the flag and everything worked!
You could try this...worked for me as I'm also adding pop as static library, instead of using CocoaPods:
Download source code from this tutorial, because we'll be adding the library files with quotes "POP/POP.h" instead of < POP/POP.h > and all files are already changed here, just copy/paste the "pop" folder from the example project to your project: http://tapity.com/tutorial-getting-started-with-pop/ You can alternatively change all files you already have inserting quotes.
In your project create a subdirectory called "pop" (File/New/Group) with another subdirectory inside called "WebCore". It's important that you create these subdirectories so they will appear as yellow "folders" (instead of blue folders) and Xcode will compile the files properly. You can check if POP files are being included in Build Phases / Compile Sources.
Add the respective POP files inside these empty subdirectories respecting the same structure of the source project (i.e. File/Add Files to "project" inside each subdirectory).
Now just #import "POP/POP.h" and start using pop animations. Doing this way there's no need to add pop.xcodeproj to your workspace.
After trying all of these solutions, what worked for me was actually was lowering the Deployment Target from 9.3 to 8.0.
Be careful of the order of your framework search paths. I had another project which I was referencing modules from that had a different version of the framework library and because that project was higher in the framework search path ranking it was picking up the incorrect header files too.
Those who suffers from it. My problem was like this,
I was having trouble with swift and xcode 8 build times. So i changed my scheme Edit Scheme -> Build -> Find Implicit Dependencies (Uncheck). I was not get trouble with simulator i was having trouble with device. So when i change it to check again it worked. And then made uncheck or vice versa.

MapBox iOS SDK within your own Xcode

I downloaded MapBox example from github using the following
git clone --recursive https://github.com/mapbox/mapbox-ios-example.git
Which downloaded it including all dependencies. Now I'm trying to create a separate project and include MapBox DSK as it was in that example. I tried creating workspace then creating a single view project then add new file and select .xcodepro for the MapBox DSK but didn't work when I tried importing MapBox.h file. I never tried importing 3rd parties API before and a bit not sure how I can do that correctly. Any Idea how I can accomplish that ?
Thanks in Advance
Just try:
#import <Mapbox/Mapbox.h>
instead of just importing Mapbox.h as suggested here:
https://www.mapbox.com/blog/ios-sdk-framework
You simply drag the Mapbox-ios-sdk project file from Finder to the files pane in Xcode.
And then click the project in Xcode files pane, Target-->Build Settings. Search for "User Header Search Paths". Specify where the MapBox sdk is located.
What I do is I put the MapBox-iOS-sdk in my project directory. And I set the path as $(SRCROOT) and make sure to set it as recursive.
While you're at it also make sure -ObjC and -all_load are set in Other linker flags.
That only helps you reference the .h files, to link, also under Build Setting, Link Binary with Libraries you need libMapBox.a.
If there is a MapBox.bundle (as in the latest development branch) in the group and files pane, you want to drag that into Target->Build phases->Copy bundle resources as well. (The add button doesn't work for me.)
I think the best way is to look at mapbox-ios-example provided by MapBox and try to replicate all dependencies into your own project.
A bit late but I did it like it was explained here: http://mapbox.com/mapbox-ios-sdk/#binary.
Not messing around with git, just dragging things into your project, easy!
I think problem here is he couldn't find a specific 'file' that was titled "MapBox.Framework" inside the folder of resources downloaded from Map Box, however what you actually need to do is copy that whole folder, which is titled "MapBox.Framework" into the frameworks section. I think the confusion was that the main folder that needs to be copied doesn't look like the yellow framework icon until you copy that folder into Xcode's frameworks section.

Resources