I'm currently doing facebook integration and have gone through this tutorial. So far, I've done everything until step #2.
To test the single sign - on, I decided to implement it in Paul Heggarty's Photomania project. To do this, as said by the tutorial linked above, I should clone the git hub repository (under step 2). I've done this by copy and pasting git clone git://github.com/facebook/facebook-ios-sdk.git
on my Terminal and it works fine. I can locate where the facebook-ios-sdk folder is in. Great, so I dragged the folder to the Photomania project.
Also stated in the tutorial that I should make a static library for the facebook-ios-sdk if I enabled Automatic Reference Counting for the App (Photomania). Which is what I did after discovering through streaming back to the Core Data Demo video that Photomania actually enabled ARC. So now, I did the static library by copy and pasting this ~/facebook-ios-sdk/scripts/build_facebook_ios_sdk_static_lib.sh to my Terminal. Upon doing so, it actually created the new library.
However, I can't see the lib folder inside facebook-ios-sdk (already copied in the Photomania). Even though through Finder I can locate the project Photomania, see the facebook-ios-sdk's lib folder in it with the Static library.
Enlighten me please.
You see, Xcode and the finder have completely independent file systems (assuming you are not checking the "copy files (if needed)" option). When you drag a file from the finder to an Xcode project, they are copied and placed under the "Copy Bundle Resources" tab, while still retaining the general file-structure that you dragged inside the Xcode file tree. So therefore, updates to finder files necessitate the new file(s) being dragged into the Xcode file tree. Simple as that.
Related
In my Xcode project there are other projects linked but somehow its not able to read the sub project.
As you can see MobiResourceManager.xcodeproj is shown in red. And thus the classes which uses headers inside it gives error. But I am not able to understand why its not able to show the project. Sometimes it doesn't show MobiResourceManager.xcodeproj in red but even then the classes using its header gives error of HeaderName.h not found.
The problem that I am facing is happening only in my system. I tried cleaning, deleting-installing Xcode, cloning the repository again but nothing works.
All the project file shown in the screen shot are sub project inside one main project.
Probably that red file was removed or moved somewhere else. Open Finder, locate the missing xcodeproj, then remove this one in Xcode and drag&drop the located one. If that red xcodeproj is inside your repository (what I suspect) then do not select to copy it to the destination.
If you cannot locate that red file, it means it is not added to the repository. For example, it could mean that you need to install it with git submodules or another way - depends on the project configuration.
Are you using the workspace? if yes then please open that file not xcode project file
I followed the instructions of Socket.IO's README.md of manually implementing Socket.IO. I dragged in the Source folder into my project and I double-checked to make sure 'Add to target' was selected. When I try to run my project, I get an error 'No such module' because zlib can't be found in Compression.swift. Am I supposed to add any other files or folder to my project? What am I missing here?
Okay, I managed to find the answer on my own, even though the documentation of Socket.IO is very unclear about this and doesn't mention anything about zlib. To import zlib, go to your project's Build Settings and scroll to Swift Compiler - Search Paths. There, you should create a new path by clicking the + in both Release and Debug. Then, add the folder path to the zlib folder that was included in the Github file you downloaded. You can either direct your folder path to its original location inside the Github folder you downloaded, or you can place the zlib folder inside your project folder. It doesn't matter where you leave the folder, as long as you're referring to it correctly. Now, build and run and the No such module error should disappear.
I also got this error when compiling the project after having added socket.io. I fixed it by adding libz.tbd to the Linked Frameworks and Libraries (clicked the + button in the General tab of the target, then I picked it from the list).
After doing that however, I got another error:
No such module 'CZLib'
I'm not sure which version of socket.io I added as I copied the entire folder from one of our previous projects. Anyway, the socket folder had a module.modulemap file which seemed to define the missing module. So I tried to fix the error by adding the socket.io folder containing the module map to the targets Import Paths, found in Build Settings under Swift Compiler - Search Paths.
The project would now compile without errors. At this point I tried to remove the linked libz.tbd and it would still compile. I have still not tried to establish a socket connection, but for now I'm moving forward without linking libz.tbd.
I am manually adding the SQLite.swift subproject to my project. As the directions indicated, I copied the .xcodeproj file to my project. This allows me see all the source files (unlike this SO question).
Everything seemed like it was working fine. However, I discovered that the source files of that subproject were not copied to my project. They are still in original location where I downloaded them. Is this by design? What if I want to share my project source code with other people in the future? They won't have the subproject source that is necessary for my project to work.
If I do need to copy the subproject source to my project, then how do I do that?
Add it to your filesystem-structure first. For example by pressing "Show in Finder" on the "Chimee"-project which will lead you to the folder it's located in. Then copy the SQLite-project structure in there.
Afterwards you can then drag&drop the xcodeproj into your project which will then still link to its original path, but as it's now inside your project-structure isn't a problem anymore.
I guess that this is by design, because when you try it via Add files to "YourProject" you can select the Copy items if needed-option but it will still not get copied (only with .xcodeproj-files, it works with all other filetypes)
After doing more research, I now feel that using a dependency manager (like CocoaPods or Carthage) is a better option than manually adding the framework to the project.
This will allow easier updating in the future.
Github source code sharing and App Store submission issues have already been considered.
Using Carthage is not too difficult if you follow this excellent guide: Carthage Tutorial: Getting Started
Notes
Delete the framework files that you manually copied in before installing the framework with Carthage.
I will leave #TMob's answer as accepted for now, but I am no longer pursuing that route.
I just followed a tutorial https://medium.com/#PyBaig/build-your-own-cocoa-touch-frameworks-in-swift-d4ea3d1f9ca3 for creating your own cocoa touch framework. There is one step where you need to right click a framework and it shows in finder, but it is not working for me. I can right click any other file and show in finder just fine. Any suggestions on how to find the framework file for dragging into another project?
well according to some apple doc I found:
Note: The standard locations for frameworks are the
/System/Library/Frameworks directory and the /Library/Frameworks
directory on the local system.
If it isn't in those directories, it is probably some custom path that would be specified on the CC line in the build output, and if you were really hard up, you could click the diff editor on the Xcode project and search for something.Framework, where something is the framework you are looking for.
... it is also possible that it is a framework that is build by a sub-project, and for whatever reason, it haven't been built yet.
I'm trying to install Alamofire into my Xcode project. However, after following all the steps for installation given by the documentation on the github project, the Alamofire.framework file shows as red in Xcode, and the project will not build. Further, there seems to be no way to fix this, because the Alamofire.framework file does not exist in the package on github.
More detailed explanation:
Following the instructions on github to install manually is fine until the final step: "Click on the + button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add Alamofire.framework."
Because we have already included the project, when we go to add a new framework, Alamofire DOES show up in the list of available things to add. However, when we add it, it shows up red. As we know, this means that the path is incorrect relative to the SDK. Ok, fine... but when we go to correct the path by looking at the Alamofire directory that we put into our project directory, there are a lot of files and none of them are "Alamofire."
I know that I downloaded the package correctly. I installed as a git submodule, I deleted it to retry, I downloaded the zip from github, retried again, etc. Even for this tutorial (http://www.raywenderlich.com/85080/beginning-alamofire-tutorial), if you look at the pictures for this step, we can see that there is no framework file in the directory!
So, Xcode demands a path to a .framework file that doesn't exist... yet we were able to add the framework somehow. Forgive me if I am confused.
There are quite a few questions out there on Alamofire install issues, but I think there must be something here that noobs like me are missing. One poster, here (Alamofire framework not found), is asking something similar, but it appears that her question was misunderstood (she did not accept any answers). I notice the "It's red tho!" frustration showing up in many comments for Alamofire install-related posts- an answer here would really help clear that up.
I was having the same issue as you, however, I found this question which made me build the project even though everything was red. To my surprise it ended up actually building successfully and afterward I was able to import Alamofire into my Swift files.
I had tried to build earlier unsuccessfully, however, between builds I did change one thing. I moved the Alamofire-master folder to the first level of my App's file structure before including the .xcodeproj file in the Project Navigator, as indicated by the tutorial that you linked. I had initially just moved it from its place in my downloads folder.
The whole copy frameworks part seemed to be a nonissue for me because the framework ended up instead in embedded frameworks automatically, after doing the embedded bin step.