I have written customise controllers in swift in xcode, and with git i have uploaded them on gitlab, now when i'm trying to clone this library with other projects, i had to add all files in xcode to use those files, it's pretty annoying though to add files if we want to use them, is there any other way to overcome this
Basically you want to maintain library files and add them all at once to your Xcode, follow these steps
go to project file -> Build Phases -> Copy Bundle Resources
and then click on + icon
select "Add Other..."
Select your folder
Now it will always build your library files along with your project files.
Hope this Helps!!
Related
I want to include the FMDB library into an existing XCode Project. I know how to install it with pods. But is there a way to link it somehow with Build Phases - Compile Sources or Build Phases - Link Binary with Libraries? I am not sure how to do that, what files from FMDB to link, where to get the files, where to Drag & Drop what...
Simply download this project first: https://github.com/ccgus/fmdb
After extracting zip you see a folder under fmdb/src.Under src have another directory named fmdb. You need to drag this folder and drop into your project. Then you can easily access FMDB code.
When I click Product -> Archive for a Mac app in Xcode 6, I want the .app file to be automatically copied to the Applications folder replacing the earlier copy.
I've noticed there are post build actions for the Archive scheme but I don't know how to achieve this.
Basically you will want to add a custom shell script phase.
You could do any number of things there.
Ive looked around a bit and cant find the answer I was hoping for, I am new to OSX dev so forgive me if this is a basic question.
Using NSTask I open up an exec file while my OSX is running that does stuff, I have to set a launchPath for this like so self.execFile.launchPath = #"/usr/local/bin/execFile";. This is fine when I'm running it on just my Mac, however, I would like to distribute this app. I am looking for a way to to save the execFile in, from what I gather so far from Googling, the apps bundle and call it from there, that way I can set the launchPath in the code and it would work on any computer. So far Ive only seen talk on how to access the app bundle but I don't know how to save a file there in the first place.
You must create a Copy Files build phase for your application target and add the exec files to the Copy Files build phase. Select your project from the project navigator to open the project editor. Select your application target from the left side of the project editor. Click the Build Phases button at the top of the editor. Choose Editor > Add Build Phase > Add Copy Files Build Phase to add the Copy Files build phase.
After creating the Copy Files build phase, click the disclosure triangle next to it. From there you can add files to the build phase and choose a location in the app bundle to copy the file. When you build the project, Xcode copies the files in the Copy Files build phase to the app bundle in the location you specified.
I am working on an app that i would like to submit to the store and i have some files that is part of the project that i don't want to be part of the archive.
For example some viewcontroller files that i made but are not going to use for this version of the app or some data files that i am reading into the database that not needed in the release.
Do i have to delete everything before creating the archive or i can some how choose for them not to be included. Also some of the viewcontrollers on the storyboard are extras would i have to delete them also?
Thanks in advance!
Only files that are part of the target you're archiving will be included in the archive and submitted to the App Store. You can add or remove files from a target by selecting it and editing the checkbox in the file inspector panel on the right:
To see all the files that are included in your target, select your project in the file browser on the left. Then select your target and the Build Phases tab.
Under Copy Bundle Resourses you'll see all the resource files that will be added to your app's bundle (and the archive).
You can selectively exclude files from your Xcode project:
In your project settings, select your target. In your target, select Build Phases pane. From there, you can exclude compilation sources and bundle sources via the "Compile Sources" and "Copy Bundle Resources" lists.
I have created a sample application to perform bump distortion, using the GPUImage framework. I added this framework to my application, but I'm seeing the following error
Lexical or preprocessor issue 'GPUImage.h' file not found.
I have added the -ObjC flag to the Other Linker Flags, but I'm still seeing this error. How can I solve this problem and get my application to compile?
Adding GPUImage framework to XCode project could be tricky. So I haved added detailed step-by-step instructions w/ images on how to do it.
Static Compilation Method (detailed solution so we don't mess up)
This is Static compilation method. In this basically we will compile the framework using ./build.sh file. And simply add it to our XCode project, then configure XCode to properly use it.
Download GPUImage from Github and extract it (or just clone it).
Go to the GPUImagefolder in terminal
Run ./build.sh
Note: This will compile and create ready-to-use binary for all the sdks on your mac.
build.sh creates a folder called build and generates compiled binaries and dumps them to folders like: Release-iPhone, Release-iPhoneOS, Release-iphonesimulator etc folders.
For iPhone use Release-iphone (This also works for simulator).
Copy (not drag-drop) Release-iphone to your XCode project's root directory so that we have a local copy of framework.
Now iPhone drag-and-drop Release-iphone onto your XCode project. Make sure to check "Copy to .." option.
Note:
This Release-iphone folder contains two sub-folders: include and lib
include folder contains all the header .h files
lib folder contains compiled binary version file called libGPUImage.a
We now need to simply configure XCode to use .h and .a files.**
Select your project in the project explorer > Project name under Targets > select Build Phases > Expand Link Binary With Libraries
Add the libGPUImage.a to Link Binary With Libraries section. You may want to Right-click on libGPUImage.a then Open in Finder and finally drag-drop it.
While we are at it, also add the following GPUImage's dependent frameworks/ libraries
CoreMedia, CoreVideo, OpenGLES, AVFoundation, QuartzCore to Link Binary With Libraries section
Now, lets configure .h headers.
Select your project in the project explorer > Project name under Targets > select Build Settings > and type search paths to see search paths section.
Open Headers Search Paths by clicking on the value field.
Drag-and-drop the lib folder to that popup. Note: If it shows absolute path, change it to looks $(SRCROOT)/path/to/lib/. (You should have the framework relative to your xcode project see step 6).
Repeat 11 & 12 for Library Search Paths as well.
Additional tips: You can add .h files to Library Search Paths or Headers Search Paths, you can make them Recursive. I have a main root-folder called Dependencies folder where I keep all the dependencies like MySDK-framework including Release-iPhone. And I just have one search-path at the Dependencies (root folder) and made it recursive.
Did you follow all of the instructions from the Readme on the project page? From the installation instructions:
You'll also need to find the framework headers, so within your
project's build settings set the Header Search Paths to the relative
path from your application to the framework/ subdirectory within the
GPUImage source directory. Make this header search path recursive.
If you're seeing the above error, it means that you did not point the Header Search Paths at the right directory where you've installed GPUImage relative to your project, and / or did not click the checkbox to the left to make those search paths recursive.
I show some screenshots of where you need to go to set this in this answer, which explains something similar for the Core Plot framework. The same principles apply, only you need to find where you installed the GPUImage framework at.
I add relative path to "Header Search Paths", but there is still a error that is "not found".
Then, I add path to "User Header Search Paths", and it works.
May help you.
finally, I realized the KEY WORD is relativeļ¼
I put GPUImage source files in my project root dir:
before I solved the problem, I add Header Search Paths is:
$(PROJECT_DIR)/GPUImage/framework
$(PROJECT_DIR)/GPUImage/framework/iOS
and make them Recursive, but error is still there, So I changed Paths to:
GPUImage/framework and make it Recursive, then it works.
Hope it helps.