How to run phone gap with xcode4? - iphone

Since moving to XCode4, I have been getting errors like:
/VERSION: No such file or directory
cp: /javascripts/phonegap..js: No such file or directory
cp: /javascripts/phonegap..min.js: No such file or directory
error: /VERSION: No such file or directory
for projects that were working under XCode3.

Open XCodes Preferences, and navigate to Source Trees. If there is no PhoneGapLib entry there, try adding a new setting with the following values:
Setting Name: PHONEGAPLIB
Display Name: Phone Gap Lib
Path: /Users//Documents/PhoneGapLib
Note that the path should be to the location of your PhoneGapLib folder, and that it may not be in your documents folder, depending on how you installed PhoneGap.

I just learned about a great web service recently made available by Nitobi (makes of PG), which will automatically generate the necessary PhoneGap files you need for use in Xcode 4.
Just enter your project name, hit a button and they'll generate a zip file for you to download. This lets you set up a new project without messing with the command line.
You could set up a new project, then migrate your older project files over.

Did you search Google for this error?
I'm a bit of a noob with PhoneGap and Xcode still, but I know there have been recent issues with PG and Xcode 4. Perhaps you're experiencing the same issues as the commenters to this post: PhoneGap + XCode4 (and more specifically, here).

Related

Framework not found GoogleMaps sdk in iOS

I want to use google map to existing(not a new one) iPhone project.Now i am using Google map ios sdk and i successfully added google map framework to my project.But i got error like this
ld: framework not found GoogleMaps
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve this issue.I am using xcode4.5 and google map iOS sdk version is 1.5. When i am creating new project with google map iOS sdk then no error getting for me.Error only for existing iOS Project.Please help me.
I solved my issue
You need to do this
Click on your project (targets)
Click on Build Settings
Under Framework search paths (set your framework path)
Following information for getting framework search paths
Right click on your framework folder (for ex: GoogleMaps.framework)
select Get info
copy the path from General->where and paste this path in your framework search path (path should contain in single line)
Good luck
I encountered a scenario in which I had to import a project that was using Google Maps and noticed the same problem - module: "Google Maps" not found.
To solve this problem it was necessary to delete Podfile.lock and Podfile folder and re-install the pods again. Good luck !
You can also :
- remove GoogleMaps from Podfile
- pod install
- add GoogleMaps to your Podfile again
- pod install
This solution works for me, you can also check the search paths a well.
Clean your project. The shortcut is command + shift + k. This will clear information that xcode has stored that might imply that the sdk isn't included.
Also press the project icon at the top of the hierarchy of files, press the target that is your project, press build phases, open link with binary libraries, and make sure that the google maps sdk is in there. If it is not, press + and add it in.
Follow the steps :
Download GoogleMaps-iOS-1.1.0.zip from their site
Unzip the file. You now have a GoogleMaps-iOS-1.1.0 folder
In that folder you have a GoogleMaps.framework folder.
Copy or move the GoogleMaps.framework folder to inside your project folder (in Finder).
Drag the GoogleMaps.framework folder onto your Frameworks group in Xcode.
In the options sheet, uncheck "Copy items into destination group's folder". Make sure your target is checked in "Add to targets". Click OK.
(Note that you can also do this the other way, by not copying it into your project folder and checking "Copy items into destination group's folder". Xcode will copy the folder itself.)
Import using #import "GoogleMaps/GoogleMaps.h". The angle bracket usually work too, but in this case it should use quotes.
From : <GoogleMaps/GoogleMaps.h> file not found Google Maps SDK for iOS
my problem was fixed by adding in:
build settings
Framework Search Paths
clickable and add the following lines:
"${PODS_ROOT}/GoogleMaps/Base/Frameworks"
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks"
If you use Pods
Left menu > Pods > Pods > choose Framework > right menu > copy path from "ios/....."
My: ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.framework
Then Project > Build Setting > Framework Search Path > Click on
$(PROJECT_DIR)/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework
Sometimes it happens when you are migrating the code from one system to another so your Framework search paths look empty at this moment, so one simple solution I try is to reinstall the podfile and it works for me.
I've been struggling with this issue for hours; I'm using CocoaPods, Swift and Xcode 6.1.1. I followed all the steps for including GoogleMaps in my project carefully, tried many different things like removing symbolic links in the downloaded package or manually linking the binaries in build phases or trying #include "GoogleMaps.h", #include "GoogleMaps/GoogleMaps.h" and "#include <GoogleMaps/GoogleMaps.h> in my bridge file, none of that worked... Finally used CocoaPods instead of including the framework myself and it worked! Hope it helps someone out there:
In the Podfile:
pod 'Google-Maps-iOS-SDK', '~> 1.9.2'
And in your Bridge file:
#import "GoogleMaps.h"
Delete derived data and delete Podfile.lock file and then run pod install.
Maybe it'll be useful for anybody, next steps helped me:
1. Delete "Headers" and "GoogleMaps" folders manually (from the Finder).
2. Run 'pod install'
3. Re-build the project in Xcode.
In my case, I forgot that I need to open the workspace file with pods, not the project.

Copying facebook-ios-sdk and configuring the Xcode project

I have gone through this document :Getting Started with the Facebook SDK for iOS v3.1
I have successfully configured my Xcode project by following it.
But I want to do it without adding the Facebook.framework.
As previously we used to only add the "src" folder which we used to clone from :Facebook SDK for iOS - Github. Why can't I just copy the "src" folder and configure my project.
I want to play around with FBFriendPickerViewController.m (dot m) file. Which I am not able to view if I follow the standard tutorial. But is available in the "src" folder.
Please how can I do that ? And it also seems that FbGraph.h file doesn't exist.
Please help.
If you want to play with the source, go to:
https://github.com/facebook/facebook-ios-sdk/
After getting the code, run this script to build the framework locally:
<Install Location>/scripts/build_framework.sh
This will drop the framework in the folder:
<Install Location>/build
Follow the same instructions in the Getting Started to include the Facebook SDK, however, you will get the framework from your local build folder.
Note: You'll likely have to modify the build search path in Xcode if you're swapping out, say one of the sample projects (that was looking for the Framework in a particular place).

Appcelerator Titanium Mobile: app.js not found

I created an app with Appcelerator's Titanium Mobile on my home machine. The path was /Users/[myusername]/Projects/ProjectName.
I checked my code into Mercurial.
The next day, at my office computer, I cloned the Mercurial repo, and then added the existing app. I tried to run it in the simulator and received the error:
could not find the file app.js.
I looked at the log and noticed that the path it was looking for was the path on my home computer, not the path on my office computer.
What can I do to make my app run on two different computers? I imagine that if I created a new app and then copied my code into it, it would probably work on the office machine. But if I checked my code in, and got latest at home it would probably be broken there.
Open tiapp.xml
Remove the line. f01a795a-46e7-4627-8558-465e5998c99d
Do a full rebuild
Bring guid tag back (just to make sure you still have it on tiapp.xml)
Do a full rebuild again.
Here's the source:
http://www.limechalk.com/blog/fix-runtime-error-when-running-appcelerator-app-on-android-emulator/
Can you re-create a new project? copy your files tiapp.xml as well as folder Resources to your new project and build again.
This issue mainly caused by JavaScript minification,either you have syntax error in one or more js files or which is hard to predict may you have some other files in you project that are not js files and cause this failure to build and then this common error .
my two cents open up you project files and look carefully for any file or files that are not supposed to be in it.

Xcode won't let go a resource file

My question today is about how Xcode deals with resource files in the app bundle which it creates. I know that it may be trivial, but I can't find an easy way out.
Basically my problem is that Xcode seems to keep on including a resource file (eg a text file) in the app bundle even if the file has been removed from the project.
Here it is in detail what is happening here.
⁃ Added a file to the project (both by choosing file - new file or dragging a file to the Xcode groups and files left column checking add to project folder if needed checkbox)
⁃ Compiled and launched the project in simulator
⁃ Verified that the file is present in myApp.app bundle, located in User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even in <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app
⁃ Deleted the file from groups and files column in Xcode
⁃ Deleted the actual file with Finder in <my Xcode projects folder>/myApp/myFile
⁃ Deleted User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app
⁃ Emptied the trash
⁃ Verified that there is no reference to the file with Finder spotlight
⁃ Verified that there is no reference to the file with Xcode search
⁃ Rebuilt and relaunched the app in simulator
⁃ Verified that a brand new /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app has been just created
⁃ Verified the content of /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app bundle: the file is still there. Where the h. did Xcode take it from?
I am surely missing something really obvious. Any help?
Have you checked the "Targets" node ? If not then;
Expand the "Targets" node and the application one.
There must be a build phase called "Copy Bundle Resources".
Check that the resource is not in the phase.
You can also try to perform a full clean of the project to ensure that no temporary files stay.
Clean used to work in xcode 3 but it doesn't seem to do a thing in 4. I found that deleting the app from the test device seems to help make the resource disappear.
Ran into a similar problem a few days ago.
It turned out that under 3.2, the simulator creates several application folders, one for each SDK version installed. I have:
~/Library/Application Support/iPhone Simulator/3.0
~/Library/Application Support/iPhone Simulator/3.1.2
~/Library/Application Support/iPhone Simulator/3.1.3
~/Library/Application Support/iPhone Simulator/3.2
~/Library/Application Support/iPhone Simulator/User
If you compile under a different SDK it creates a new application directory for the app within the folder for the new SDK. I had an alias to the old folder and ended up looking in the wrong folder at a version of the app that Xcode was no longer targeting and therefore never changing. IIRC, I had to track down the new app in the matching SDK folder.
I had the same problem. However the solution proposed in the answer, didn't solve my problem.
In the Targets > Copy Bundle Resources, I don't see the "ghost" files.
I tried doing a full clean up, delete the app and reinstall it, and I still have the files in my app.
The solution I found was by manually deleting the contents of the folder: ~/Library/Application\ Support/iPhone\ Simulator/4.3/Applications/
Remove the app from the simulator and delete with finder the directory of your app in Library > Developer > Xcode > DerivedData.
I ran into a similar problem. Xcode 4 keeps complaining about missing resource file even though it has been removed from the project. It results in build error.
This is how it's resolved:
1) Open the .pbxproj file
2) Delete all the lines referencing the resource file that you want to get rid of
3) Build it
I had a similar problem with a .scnassets file - XCode Copy Resources only lists the .scnassets file (a real folder, not a group) but also remembers and copies it's contents even if they've been deleted. An intentional clean fixes this. Moreover, files deleted from a ghost .scnassets files appear to be copied every time you run the app, instead of the first time they're needed. Cleaning speed my build time up by 300%!

Why can't I just send my zipped Xcode project folder to a friend, and it works?

I always use one folder on my filesystem for an Xcode project. It contains all project files. When I zip it and send it to a friend, she can't just ipen the xcodeproj file. It opens, but all paths are broken and build fails because all the classes don't find the #include'd files. But when I download i.e. some example projects from apple, these work perfectly. What am I doing wrong?
UPDATE:
I'm doing it like this:
1) I create a project and specify an directory on my desktop
2) In that directory I create an "images" directory and add images to it
3) I pull this images directory out and drag it into the Resources Groups&Files. Xcode asks if I want to copy it to destination folder, I click no. Because it's already there. All other things are set to default.
4) all other things are just created within xcode, and xcode just puts all classes in the Classes directory of my project.
5) when I want to add images, I first put them in the directory of the project, and from there drag them into the Images group in xcode. That's to make sure xcode doesn't mess them up with everything else. Otherwise it would just copy them to the root of my project directory rather than inside the Images directory, which doesn't make sense. In fact, the whole Groups&Files filesystem doesn't make sense at all, it's one big mess. Apple's biggest mistake in Xcode so far. That's why I have to do such stupid things.
We don't really know exactly what you're doing so it's hard to see what you're doing wrong.
Perhaps inspect the xcode project files directly, see if you have hardcoded paths. That's a sure fire problem. Make sure you copy resources into the project instead of referencing them externally, etc.
I expect that you have "search path" build setting set to an absolute path on your machine, rather than a path relative to the project. Best way to tell is to post a portion of the build transcript from the failed build and look at the -I directives. If those paths don't exist on your friend's machine, then they should be changed from absolute paths to paths that start with ${SRCROOT}.
Are you just trying to build on the second machine or are you trying to deploy to a device on the second machine? If you are trying to deploy to a device (iPhone or iPod Touch) then it probably has something to do with Code Signing and Certificates.