PhoneGap application: "ERROR: Start Page at `www/index.html` was not found" - ios

I have created a Phone Gap based application on iPhone. After the first run, I have dragged my www folder, containing index.html into the project, but still I am getting the following error in the simulator:
ERROR: Start Page at www/index.html was not found.
Do I have to mention the name of index.html in a plist file or anywhere else? How can I resolve this; can any one help me?

It's an incompatibility between PhoneGap and XCode 4. To resolve:
right click on your project and choose "Add files to [project
name]...";
choose the www folder from your curent project's folder (it's
included in there, but not added as a reference);
when you select the folder, make sure you choose "Copy items into
destination group's folder" as well as "Create folder references for
any added folders".
Note: if you choose "Create groups for any added folders", the app will still fail at runtime.

For those who are as silly as me...
I had forgotten to run cordova build.

Quit XCode and apply below command in terminal, its work for me
ionic cordova prepare ios

Try removing the reference, and adding it again. Did you add it as a "Reference"? The icon should be in blue. Then clean and rebuild.

I had the same problem where it worked in the simulator but not a device. My issue was case sensitivity. My file was Index.html instead of lower case index.html.

You could also just drop the www folder w/Finder into the Xcode Nav tab (root), after that just check dialog checkboxes "Copy items into destination group's folder" and "Create folder references for any added folders".

What versions of Xcode and PhoneGap are you using?
If you're using the older Xcode 3 and are creating a new project using the PhoneGap template... it should automatically create a www folder for you, along with a generic index.html file. If you've dragged your folder and index file into the project, then you should have been overwriting the existing files.
If you're using Xcode 4, there's a known issue with getting a PhoneGap project set up. It would be helpful to know what tutorial/guide you are following (assuming you are using a guide).
In very random cases, changes you make to your files/folders directly (via Finder) might not be picked up immediately by Xcode. You could always try quitting out of Xcode and re-opening your project, to ensure Xcode is pulling the latest files.

Well cordova build ios android was the only thing that worked for me, and cordova build didn't cut it.

in xcode target - Copy Bundle Resource
add www folder

You can fix this issue by adding www to Targets > Build Phases > Copy Bundle Resources

Related

Cannot preview in this file - active scheme does not build this file : SwiftUI on Xcode 11 in CatalinaOS

I opened Landmark App using SwiftUI on Xcode 11 in macOS Catalina(10.15) and while opening the Canvas Editor for .swift files containing SwiftUI is showing
Cannot preview in this file - active scheme does not build this file
Try Again, Diagonistics option or restarting Xcode not solving the problem.
If this is a new project coming from a copied folder and inside an iCloud folder, just close Xcode and relaunch it. The sync was not yet done.
Select the Scheme that has the current file to Preview
You should go through Xcode and Apple SDKs Agreement and you can do it by running the following in terminal in mac:
sudo xcodebuild -license
After doing that reopen your project.
I experienced the same issue. All I did was to copy the "StartingPoint" folder out of the downloaded folder and relaunched the project. It worked!!!
I bumped into this too, following the Landmarks tutorial. When I created the 'CircleImage.swift' it was not letting me preview it, with the above error message.
You can see the current Scheme you're using by going to Product > Scheme. I've got macOS selected.
Clicking on the CircleImage.swift file loads it, and in the rightmost sidebar it shows the Attributes inspector. A few buttons to the left of that is "Show the File inspector".
There, you can see this file's chosen "Target Membership". My problem was that "Landmarks (macOS)" was not checked. Checking this immediately got the Preview working.
I imagine I could also have changed my Product's Scheme to iOS and it would have worked, as that was already checked.
I encountered the same error for some of my SwiftUI View files when trying to preview on Canvas. What fixed the issue was I copied the code within the current file, deleted the file, created a new SwiftUI View file under the same name and pasted the original code. Hope that helps!
Creating a new folder in Documents/Desktop and copying the files over also resolves the issue.
This problem happened to me when I copied a folder into my project with the "Create folder reference" option instead of the "Create groups" option.
The problem was solved when I deleted the folder from project and copied the folder again with the latter option.
I just upgraded to both Monterey 12.3, and Xcode 13.3, and boom ran into this issue. Things were fine before the upgrade. Nothing above helped.
Creating a new project does help. So the only thing I found is to create a new project, and just add the files from the old project to the new one. Yuk.
EDIT: I hadn't rebooted the computer (mac mini), after reboot things were fine again.
In the schemes I was able to select, it contained only one scheme. Reopening the folder in a folder that's not in the Downloads directory made live editing work for me
Restarting my PC worked for me.
The described issue happened to me after cloning a project via git (no iCloud syncing as described in another answer - so I definitely know that the sync itself was completely done).
Funny enough restarting Xcode did the trick.
Just closing and opening the project isn't enough.
I found that the file I was trying to preview was not listed in Target -> Build Phases -> Compile Sources. Once I manually added the file, Preview worked. I had drag and dropped a directory into the project, and for some reason Xcode had not added those files to that list.
Try About this mac -> Storage -> Manage -> Developer, Then delete Xcode cache from here then restart Xcode...This worked out for me
Make sure the file you are trying to preview is in your app (the folder with the same name as your project).
I was able to fix newly created files not previewing by moving the file into my project.
Another solution:
Make sure you select file type Swift UI instead of Swift File when you create the file.

Could not find a valid GoogleService-Info.plist in your project

When I run my swift 3.2 code with Xcode 9 beta 4 this is the error I get:
*** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
I already have a GoogleService-Info.plist file that is named exactly like it should and it is valid.
Is there any trial to firebase or something like that?
Remove the Google-Info.plist file from your project and try to add it from your project folder's option menu.
EDIT:
this is how you remove a plist file
Xcode 10 Error: Multiple commands produce
I had the same issue.
Click on the Googleservice-info.plist in your project and check Target Membership for app in the inspector. That fixed it for me.
That is the reason for this crash and removing the file and adding again is another way of doing as suggested by answers above. But the actual cause is this and this is the right way to solve it.
Please refer to the image below for further clarification:
Once you add the file to the project, you may also need to add it to Build Phases in the Compile Sources section.
Add the GoogleService-Info.plist in Build Phases as screenshot above:
Make sure the name of the file is correct, i.e: "GoogleService-info.plist"
Add it to the project in mac finder under the project name and then drag it into the project to reference it.
Finally, as Silvajee mentioned, go to the file inspector for the plist file and tick the box under target membership to include it as part of the project.
If you have multiple environments (Production, Develop, Staging), you will need a different Google.plist for each.
They all have to have the same name.
To get around this, create folders for each of these files (one for each environment) and place them inside their corresponding folders.
When you drag the files from the Finder to Xcode, make sure to select the proper environment for each under Target Membership
That will do the trick and allow you to build environments separately. Especially if each environment has a different Bundle ID.
Make sure your file name is correct as "GoogleService-Info.plist". Any other name would cause problem. Restart XCode and you are good to go.
Unfortunately or fortunately, the error specified is very accurate. There is only one option available right now. i.,e placing Google-Info.plist file in your project properly. Try to remove and add that again. Also, check if a target is selected or not.
Restarting Xcode worked for me, none of the above option worked.
These steps solved my problem. FOllow these.
1.You must drag and drop the GoogleService-Info.plist file into your project in a location such as Shared Resources. When you have successfully added the file, you should also make sure to include it in the project build:
2.Double-check that in the "Build Phases" section of your project that your project is including GoogleService-Info.plist.
3.Double check the file name. The file name must be exactly GoogleService-Info.plist common misspellings include GoogleServices-Info.plist and GoogleService-info.plist - case sensitive and exactly named only will work.
Actually this error is occur when GoogleService-Info.plist file is not actually located in our project folder but it just have a reference to that file where it is downloaded. So solution is that remove reference to this file and again add it to your project folder by drag and drop or by using "Add Files ..." option by right click to your project folder. Also recheck whether file is locating your project folder destination otherwise error will be occur again.
Don't forget to check your "GoogleService-Info.plist" file have same name as shown in error otherwise rename it.
For those of you working with Ionic, make sure to open your .xcworkspace file in Xcode first, then drag the GoogleService-info.plist file into the Resources folder.
Most tutorials online don't do a good job of explaining that portion for some reason.
Shout out to Shahzaib Maqbool because his comment helped me get this for my project.
Below setting can fix my compiler fail
1. Add to "Copy Files"
2. Not add to "Copy Bundle Resources"
We must make sure that full path is correct in Xcode. It would be better to add it from the start. If you already did, jump to step 5.
Quit Xcode.
Make sure that file name is correct, "GoogleService-Info.plist".
Add .plist file to project folder. Same level with Podfile, .xcworkspace, etc.
Open Xcode, identify .plist file on Project Navigator. If it's not there, right-click and click Add new file to "[Project Name]". Make sure to click project name below Add to targets option.
On Project Navigator, click on GoogleService-Info.plist. Select File Inspector from right navigator. Ensure that Full Path is correct. If not, click on folder icon and select the .plist file inside the project file.
Build. If still doesn't work, Quit Xcode and Build again.
Doing a clean then build a couple times worked for me.
1 - open "GoogleService-Info.plist" and change any or to and
2 - reopen the xamarin solution
3 - it should work now
I solved the issue by deleting the project from Firebase and deleted the GoogleService-Info.plist from project. After I again added the project to Firebase and added the new GoogleService-Info.plist file worked for me.
This error occur download google service more than 1 time. When we download first time from firebase, it's like GoolgeService-Info.Plist. If you download again, that will come GoogleService-Info(1).Plist. We need to remove (1) from GoogleService-Info(1).Plist.
Please try this.
Click on GoogleService-Info.
checked the target membership on the right side .
Clean and build . It will work.
2022 Update
If you're migrating from older firebase version and want to initialize Firebase from Dart only, then you have to remove Firebase Initialization from AppDelegate.m or Appdelegate.swift
in swift, remove FirebaseApp.configure()
and start again.
I know this question has a million answers already, but perhaps this solution will help someone who isn't using Xcode build configs like many answers above.
If you're converting an iOS app to Catalyst (as I am), then I found a minor but obtuse difference is Catalyst apps make bundles with a "Content/Resources" folder structure that was throwing off my builds for a while. My build phases copy my release/debug Plist files for me and the pathing difference from iOS -> Catalyst was causing this error.
You can probably solve this problem many ways, like the multiple folders with same named Plist files above. I use a custom bash script via build phases, and copy the file manually like this:
if [ $CONFIGURATION == "Debug" ]; then
echo using DEBUG firebase!
# Mac Catalyst appends a "Contents" folder so we need to handle that explicitly here
if [ $IS_MACCATALYST ]; then
#echo "MAC CATALYST BUILD"
cp ${SRCROOT}/${PROJECT-DIR}/your-custom-paths-here/GoogleService-Info.plist ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Resources/GoogleService-Info.plist
else
cp ${SRCROOT}/${PROJECT-DIR}/firebase/debug/GoogleService-Info.plist ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
fi
fi
Go to build phases and add file in copy bundle resources. Thats it.
delete any other "GoogleService-Info.plist" files that have been previously installed. in my case, when I installed it, it was names as "GoogleService-Info.plist-2" since I had another file installed in the same folder. it looks that this will create a confusion for firebase. I deleted all old files and changed the name of the current one to "GoogleService-Info.plist" exactly. it worked.
In my case something went wrong when i merged conflicts in project.pbxproj
GoogleService-Info.plist -> didn't have Target membership selected on the right pane and I couldn't select it because project.pbxproj was corrupted (even though build was successful)
I had to rollback project.pbxproj and after that GoogleService-Info.plist had Target membership selected.
Make sure project.pbxproj isn't corrupted after merging conflicts (it had something to do with attempted to initialize an object with an unknown UUID)
For anyone using Xamarin by mistake (you should avoid this piece of tool by all means):
open project file as code, and check that the file has import tag BundleResource, and not None (the red one is the correct one):
I'm using FirebaseUI and was receiving a slightly different error when pressing Sign-In with Google:
***Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'OAuth client ID not found. Please make sure Google Sign-In is enabled in the Firebase console. You may have to download a new GoogleService-Info.plist file after enabling Google Sign-In.'
What fixed that issue for me was changing this line (that seems to be deprecated)
[[FUIGoogleAuth alloc] init]]
to
[[FUIGoogleAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]]
when building providers list
NSArray<id<FUIAuthProvider>> *providers = #[
[[FUIGoogleAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]],
[[FUIPhoneAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]]
];
Another easily overlooked problem is when you have multiple PLIST files downloaded so the file is not exactly named 'GoogleService-Info.plist'.
I had multiple copies so was trying to use 'GoogleService-Info.plist(2)' which throws the same error, so make sure the file itself is named as it is meant to be!
My problem same this case and solved that ->
ı added xcode runner Open Xcode, then right-click on Runner directory and select Add Files to "Runner".
most importantly;
terminal: cd ios- " pod install "
and info.list thats ok.
ı hope your problems solved
I had to same issue and same error what you have. I downloaded from Firebase more than one info.plist file that why my MacBook save these files like
GoogleService-Info.plist,GoogleService-Info-2.plist,GoogleService-Info-3.plist
Then I copied mistakenly in my project GoogleService-Info-3.plist then I took same error. Then I just copied GoogleService-Info.plist and problem has been solved.
But be careful about bundle identifier. You have to copied correct project plist.
Just drag and drop the file into terminal, don't copy paste from Notes or TextEdit or from elsewhere.

How to resolve Failed to read file attributes for "/Users/path/myapp/Images.xcassets" in Xcode?

Suddenly I am getting error in Xcode 9 beta like
"Failed to read file attributes for "/Users/path/myapp/Images.xcassets" in Xcode?" and unable to build as well I just dragged the "Images.Xcassets" folder to up that's it.
I checked targets, Copy Bundle Resources and "Images.Xcassets" folder existed. But, I am unable to build the project.
I found out that my folder name is images.Xcassets, which Group name and Full Path is Images.xcassets. You should check your group name and full path in File inspector.
EDIT:
Here are two solutions:
1. Remove the group from Project Navigator (ALT+1), and add files back again (OPTION+ALT+A).
2. Click the folder icon from File Inspector (OPTION+ALT+1) and choose a new folder.
It's an issue of latest Xcode9. There are two ways to solve this issue.
Follow these:
Remove reference the images.Xcassets file from your project. Once you remove it from project and add to project again solved my problem.
If option 1 don't work, delete(Trash) the full images.Xcassets file and add all icon again.
Make sure you add this in your icon name Build settings.
"Quit the Xcode and restart." it worked out for me. I got the same problem with Xcode-9.0. I have tried it in multiple ways like deleting Derived data, Cleaning the project and closing the Xcode but nothing worked.
Delete your derived data and then Quit X code
Cmd+q quit the xcode and open it again.
I had this same problem though, using local pods. It seems that xcodebuild is now case sensitive relative to the resource path.
~/Folder/MyProject != ~/folder/MyProject
Closing and reopening Xcode fixed the problem for me

Getting error after changing project folder name in XCode

When I created my project, I called it "Project1". Then, later I've changed it to "Project2" from the Xcode. I changed all "Project1" to "Project2", but now, when I compile my project, it looks for files in Project2/Project1/myFile.swift and I get the next error:
<unknown>:0: error: no such file or directory: '/Users/myusername/Copy/Projects/Project2/Project1/myFile.swift'
I need to make that it will look at
/Users/myusername/Copy/Projects/Project2/myFile.swift
without Project1 in the path.
How can I solve this problem? Also, I changed from Xcode Identity and Type section Location of my project.
Today I had the same problem when I renamed the folder containing the Xcode project and some parent folders of it.
In my case there where a .swift file shown with it's name in red in the list of files of Xcode (Navigator area). I think that this means that Xcode was not capable to find that file.
I selected that file (actually it's not a real file but a representation of it).
Then, in the File Inspector (Utility area), I clicked on the Folder icon and chose the file on Finder.
This worked for me.
Renaming projects in xcode in one of the most annoying things in iOS development. I assume you want to rename your app. I faced this problem once and figured out a simple, clean way to do it.
Go back to the point where everything worked.
Open project in xcode and click on the project icon in the project structure( first file)
Go to the info tab
Search for Bundle Name. Most probably it will automatically be set to $(PRODUCT_NAME) which is a shell variable that will set your app name the same as the project name.
Set it to whatever you want your app name to be
Done
Note : If you use custom URL Schemes this might produce an error when redirecting.
ALWAYS use git or some other SVN in your projects. This will come in handy in this kind of situations
Change you folder name in you finder "Project1" to "Project2"
Remove "myFile.swift" file from project (copy on Desktop)
Restart Xcode. Copy "myFile.swift" in project select "Copy file to folder" hope this will help.

Interface Builder could not open the document ".storyboard" because it does not exist

This problem is getting me really crazy. Xcode is looking for a storyboard in my project in a differente location from my project. I tryed removing the file, adding it again, cleaning the project, etc but didn't have luck.
This is the error.
cd /Users/fmartin91/Projects/loovin/loovin-ios
setenv IBSC_MINIMUM_COMPATIBILITY_VERSION 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv XCODE_DEVELOPER_USR_PATH /Applications/Xcode.app/Contents/Developer/usr/bin/..
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool --errors --warnings --notices --minimum-deployment-target 7.0 --output-format human-readable-text --compile /Users/fmartin91/Projects/loovin/loovin-ios/Build/Products/Debug-iphonesimulator/loovin.app/Base.lproj/LOOVProductIndex.storyboardc /Users/fmartin91/Projects/Base.lproj/LOOVProductIndex.storyboard
/* com.apple.ibtool.errors */
/Users/fmartin91/Projects/Base.lproj/LOOVProductIndex.storyboard:
error: Interface Builder could not open the document
"LOOVProductIndex.storyboard" because it does not exist.
I could fix this bug by killing ibtoold:
$ sudo killall -9 ibtoold
Why does ibtool need a daemon anyway?
Your storyboard is not in NSBundle mainbundle.
this problem is probably due a "Copy Bundle Resources" in "Build phases" problem.
For corrected it verify if your storyboard file is in "Copy Bundle Resources" for all targets. On project navigator select the project file select Build phases tab and check it is.
When you upload your file to google drive without zip, it appends the extension of .storyboard to .xml automatically and hence when you download it obviously the file won't exist.
To solve this issue, go to the:
[project folder] > [Project folder] > [Base.lproj]
There would be a .storyboard.xml extension type of file which you would have to rename it to the .storyboard extension. And hence your work is done.
Story board error solving visual guide:
I had a very similar problem and it took a few hours to resolve. Clearly xcode locked itself in some strange state that the project explorer could see the xib file while the compile could not. Finally this got resolved when I changed the Location in the File Inspector from Relative to Group to Relative to Project. I got this by comparing the project.pbxproj file in a regular text editor to search for any clues.
I encountered this same issue and here's how I resolved it:
Save a copy of the affected file outside of the project
Delete the file from the project, selecting Move to Trash to completely delete the file and reference from the project
Edit ProjectName.xcodeproj/project.pbxproj to remove all lines referencing the affected file
Re-add the file, making sure to check Copy items into destination group's folder (if needed)
Clean and build
I just ran into this issue running Xcode 9.2. I had copied my files from a school computer onto google drive and then downloaded them at home.
When I opened the files at home it kept telling me main.storyboard and the launch storyboard did not exist. The two storyboard files would display as xml, so they clearly existed, but even right clicking to "open as" produced nothing. After much troubleshooting I found a fix that worked for me.
SOLUTION:
Open your project folder, then the next folder named the same as your project. Open Base.lproj and you will see your two storyboards in xml format. Copy both the files, paste them into the same folder, delete the .xml and confirm the change to .storyboard. Do this for both files and you're set!
This happened to me after a git merge. I changed some storyboard localized files from one project to another and Xcode seems to keep on searching the file in the old project.
My solution was:
Edit the OldProjectName.xcodeproj/project.pbxproj
Search for the Storyboard name
Delete the references to the Storyboard name that appear followed by localization stuff (things like "Base.lproj", "es.lproj", etc)
Delete also the following localization entries (because they refer to the Storyboard file)
Clean and build
Repeat if other files keep throwing compile errors
For me I use xcode 10,
Click on the your project name (blue icon on left) > Build Phases > Under Copy Bundle Resources
Find the file, remove the duplicates if it’s there. Clean project and run again
I encountered same problem when moving the project to another computer. I followed below steps to solve this issue:
Open previous Main.storyboard file as Source Code, copy all
Create a new Main.storyboard file, Open as Source Code, paste
Delete previous Main.storyboard
Clean and build project.
In my case I found that the storyboard was placed in a group that referenced a folder that did not exist in the "Identity and Type" panel.
Removing that group and the storyboard, and adding it back referencing an existing folder solve the problem for me.
For me resetting the container folder of Main.storyboard file worked
I resolved this by doing this:
Open your Xcode project folder in finder, then find the file that you can't open.
Drag that file to your file path in Xcode Project (Inside Xcode App) like this.
Thick "copy item if needed" and choose "create folder references" and then click finish.
Restart Xcode
I could solve my issue, i really don't know how i did it but the things i tried were cleaning and building the project like a billion times, i hope this will be of help to anyone.
I just experienced this, and fixed it by restarting the darn computer. I found out more about it, though. In my case, my ibtool scripts weren't working, giving file-not-found errors just like yours. However I noticed a change in behavior when I ran them as sudo:
2013-09-20 20:49:40.339 Interface Builder Cocoa Touch Tool[58454:303]
CFPreferences: user home directory at
file:///var/root/Library/Application%20Support/iPhone%20Simulator/User/
is unavailable. User domains will be volatile.
Subsequent commands would fail or return without doing anything. So! ibtool/Interface Builder/whatever is somehow using some other launching service to run itself, with some other username or privileges.
Could it be that I installed some tool updates for Xcode 5.0, and it screwed up whatever serving process was running? Yes it could :)
I experienced the same situation with Xcode 7 beta 5. Rebooting my Mac did the trick.
Goto Build Phases > Copy Bundle Resources > Check for the Storyboard for which you are getting error > It should be displaying as blurred > If YES then delete its reference and add it again > Compile again.
In my case, folders in the project navigator and finder were not formed exactly the same. The Main.storyboard was in \Views folder in the project navigator but not in finder. Xcode wouldn't let me quit the app, because Main.storyboard couldn't be saved.
Here's what I did, that solved this problem:
Identify which files are missing or misaligned in your project navigator and finder simultaneously.
Copy Main.storyboard and other files that are not in their right place to a safe location.
Force quit Xcode from Activity Monitor. Reopen Xcode.
Paste previously copied files in finder. Make sure that the folder order is the same as the Xcode project navigator.
In Xcode, from project navigator right-click to where you need to add files and click add new files.
Add files from the finder.
Clean and build.

Resources