How to add js file to my xcode project? - xcode

I add some js and css files in my xcode left project tree. but when I build this project , I got the warning : no rule to process file '$(PROJECT_DIR)/js/builder.js' of type sourcecode.javascript for architecture i386
I think if I lost some setting with my project in xcode , but How to add some like js and css files? Thank you very much!

When you add the JavaScript file, Xcode detects that the file is a source code file, assumes you want to compile it and automatically adds it to the Compile Sources build phase.
To stop Xcode trying to compile it and make it copy the file instead, expand your target in the Groups and Files list, remove the JavaScript file from the Compile Sources build phase and add it to the Copy Bundle Resources build phase.

For Xcode 4, click on the main project, click on Build Phases. Open up Compile Sources and Copy Bundle Resources then you can then simply drag the files from one to the other.

I got the same problem and I could solve this problem with simple technique in Xcode5. when you add/drag your HTML files into Xcode bundle you need add them by grouping as 2 types
1.assets
2.index.html
you need to add these two files only.
assets folder contains all HTML files like images,.js, content,css. All HTML files should be
included in assets folder. what I mean is you need to group all HTML files in assets folder as a single folder.
Then you drag that particular folder which contains ASSETS and INDEX.HTML files into Xcode bundle.
Then do some changes in your controller declaration and implementation sections. That's it you can run your application in simulator now.If any one have not understood my answer please let me know I will add clear information with screen shots.
I hope it will help some one..Thank you!
If anyone have any doubts still let me know i'll explain step by step

Related

macOS app help document file folder disappeared

I am trying to build the help file for a macOS app.
I imported .help folder to resources
the content of title file index.html is
items in info.plist file related help file
built my app content resource folder
it looks like the builder only keeps the index.html and removes the folder .help
your comment welcome
You might try removing the .help folder and adding it again. It should appear as a single object (bundle), and not as folder (and definitely not as a project folder which are just containers for assets, like a loose index.html file).
What you want is the the entire .help folder as a single asset that gets copied to your finished application bundle. It should look like an opaque item in Xcode:
Then in your application's build phase setting, the entire .help folder should be copied, as a single entity, to the app's resources:
If you have individual .html or other help files included in any of the build phases, or selected as members of a target, remove them.
I imported .help folder to resources
Incorrectly. You imported it as a group. You should have imported it as a folder reference.

Is it possible to use custom icon for Xcode file template?

In our project we generate multiple swift files when using the file xctemplate configuration. However, with this configuration, there is no icon displayed in Xcode when generating the files (see attached image). We did try to add two images to the template folder: TemplateIcon-png and TemplateIcon#96.png which yielded no success. Is it possible to use a custom icon for file templates in Xcode?
Not sure if you're still looking for an answer to this, but you should be able to create an .icns icon package named TemplateIcon.icns. This should contain your template image(s) to be displayed in the new project picker.
I suspect your issue was trying to use the PNG assets directly.
See the Base Acceptance Testing Bundle for an example. It is part of the OCSlimProjectXcodeTemplates repository.

Installation process of Gzip framework in Swift

How to install the Gzip framework in swift 3.0.1 and also how to use it in swift 3 and iOS 10.
For This actually they given the following instructions like
1.Build Gzip framework.
2.In Build Phases, add Gzip.framework library to your project.
3.import Gzip in your Swift file.
4.Use in your code.
But among all steps How to implement the 1st step like building the Gzip framework.
Thanks in advance.
1.For the solution, Just download the project from the GitHub and then open it.
2.Now in the project navigator panel expand the folder named "product".
3.In that folder beneath you can see the Gzip.framework in red color, on that you right click in order to see it in the Finder.
4.From that Finder location, you just drag and drop into your project.
5.In General tab under linker and binaries you add the framework.
6.And finally import the header module like "import GZip"for required class and then implement the required things.

Save SASS to same as origin files

I am using sass with prepros compiler and sublime editor. I need to have each scss file complied with the same file name.
For example:
I currently have-
header.scss
content-top.scss
footer.scss
and they are all compiles into style.css to create one full style sheet.
I wish to have a style folder with
header.css
content-top.css
footer.css
which will be done automatically when saving and compiling like I normally do.
How can I accomplish this?
Thank you
Check this link out.
It states that you can adjust your project structure (in your case CSS folders) in project settings.
If I remember correctly you may have to buy it so that you can compile more than 4 or 5 Sass files, but I may be wrong.
Also check that you aren't "only" importing sass partials because of this:
Any Sass and Scss file (i.e. including partials) imported by another
file are not shown in the files list but they are still watched by Prepros.
The parent file is re-compiled whenever any of the imported files are changed.

How to use different config.xml for different Phonegap Targets in Xcode?

I want to have multiple targets in my Phonegap Xcode project that share resources but load from a different index.html file.
The index file that is loaded is determined by the config.xml file.
How can I define a different config.xml file or a different index.html file for these different targets.
Alternatively, is there a better way to apply settings, and deploy an app that is 99.9% the same?
I'm using Cordova 2.8.1.
Thank you.
PhoneGap's CDVViewController.m reads config.xml from the main bundle, so you can
Create a separate directory for each target.
Create a config.xml for each target in the associated directory from step 1.
Use the Target Membership panel in Xcode's Utilities view to set the target membership of each config.xml from step 2 to the correct target.
If the only difference is the starting HTML file, you could modify your AppDelegate.m and use a compile-time constant to define the starting page:
self.viewController.startPage = [NSString stringWithFormat:#"%s", START_HTML_FILE];
To set the compile time constant, go into Build Phases tab in Xcode for each target and use the -D compiler flag. For example:
-DSTART_HTML_FILE=\"target1-index.html\"

Resources