Can't build on Xcode using 'capacitor js' commands - ios

I'm practicing capacitor js, and was able successfully to package the (html, css & js) files and build them on 'android studio' according to the commands on 'https://capacitorjs.com/docs/android'.
Yet when i powered up macOS version 10.14 on VMware and tried to do the same steps 'https://capacitorjs.com/docs/ios' to build on Xcode, the following warnings and errors occured...
Bugs
I traced the path written in the error and couldn't find neither file nor folder named Pods....
The App folder
I'm using XCode version 11.3 and did install 'Node.js & Xcode command line tools' as mentioned as "capacitor js requirements" on the documentation, also installed CocoaPods.
It's my first time using macOS so I might have missed some additional steps that needed to be done.
Would be very thankful if anyone could guide me through that bug.

Looks like you've openend the .xcodeproj file. Don't do that, use the .xcworkspace exclusively. Also, if you don't have a Pods folder, you probably forgot to run pod install

Thanks to Gereon the step that was missing is to use the command pod install on the 'App' folder that has the 'Podfile.txt', it will extract some extra files including the required Pods folder.
App Folder After Using pod install
If after building you faced the following error...
failed to initiate service connection to simulator
Just clean the build folder and run again.
To clean the build folder you can use the shortcut Command+Option+Shift+K or Menu Bar → Product → Hold Option Key → Clean build Folder.

Related

jonkykong/SideMenu is not working in Xcode 11.3 and iOS 13

Describe the bug
Clone and run project in xcode 11.3 with Catalina MacOS and example project will not compile.
To Reproduce
Steps to reproduce the behavior:
Clone/Download project
Open it in Xcode 11.3
Compile Example Project
See error
Expected behavior
Example project must compile without
error.
As hinted at in the comments, the project has dependencies which cannot be found.
According to the path that it is complaining about, its missing one or more Pods
So normally you would go into the project folder in your terminal and enter pod install which will install the missing libraries.
Once you have done this open the workspace (not the project) and then it should work.
Problem is related to different than expected file structure and naming conventions of the Pod
Copy a Info.plist from SideMenu folder to Pods->Target Support Files->SideMenu folder and rename it there to SideMenu-Info.plist
Copy the SideMenu.h from SideMenu folder to Pods->Target Support Files->SideMenu folder and rename it there to SideMenu-umbrella.h
Copy the SideMenu.h from SideMenu to Pods->Target Support Files->Pods-Example and rename it there to Pods-Example-umbrella.h
Rebuild the project

Getting error in Xcode no such file or directory found with libReactNativeLocalization.a during build and archive

I am having issue in Xcode while I try to build or archive my react-native project. Xcode throwing error like no such file or directory: '/Users/...../DerivedData/myproject/Build/Products/Debug-iphonesimulator/libReactNativeLocalization.a'.
when I run react-native run-ios or in release mode react-native run-ios --configuration Release then it is working perfectly fine but when I try to build or archive it from Xcode then it is throwing error.
I am using Xcode version 10
My react-native version is 0.57.4
iOS development target is 9.0
react-native-localization version is 2.0.3
Tried things which didn't worked for me
Removed node_modules and pods completely and run npm install and pod install didn't worked for me .
In menue File --> workspace setting changed build system from Use Shared System to Legacy build system. in this particular case app is build and archived successfully but when I lunch my app then it crashes after splash screen.
Removed Derived Data completely and rebuild again still getting this error.
If I remove react-native-localization completely from my project then all the things are working fine and I am able to build and archive the project.
When we run react-native link react-native-localization command then it also applies the changes on ios app too which creates an issue in our case. So due to this command, it creates an entry in project_name → ios → podfile (podfile)
Here ReactNativeLocalization is pointing to project_name/node_modules/react-native-localization directory due to this line when we run pod install command then there is one dependence React in this package is going to reinstall in your pods as you can see in this image.(as you can see here)
Follow the following steps to overcome form this issue
After react-native link react-native-localization command navigate to project_name → ios → podfile and remove or comment pod ‘ReactNativeLocalization’, :path => ‘../node_modules/react-native-localization’
Now its time to link react-native-localization library manually from Xcode. So to link this library manually open project_name → ios → project_name.xcworksace file in Xcode and select your target.
After that in project navigator right click on library and select Add Files to “...” and after that navigate to project_name → node_modules → react-native-localization and select ReactNativeLocalization.xcodeproj file.
Now navigate to project Target → Build Phase and expand Link Binary With Library after that click on plus icon and add libReactNativeLocalization.a library
I had been stuck on this issue since morning. A simple hack made my build.
I observed that in folder Xcode/DerivedData/MyProject/Build/Products/Debug-iphonesimulator/ lib files were being generated in their folder. i.e libLinearGradient.a was in libLinearGradient.
One .a file which was being successfully lined was there without it's folder so I did the same for all .a files. ( Simply put them outside without their folder.)
So now path became Xcode/DerivedData/MyProject/Build/Products/Debug-iphonesimulator/libLinearGradient.a instead of Xcode/DerivedData/MyProject/Build/Products/Debug-iphonesimulator/libLinearGradient/libLinearGradient.a

Xcode Buildtime Error: 'Unable to load contents of file list: '.../Info.plist' (in target 'xxxx')

Xcode started throwing this error in a project today, and I'm having trouble figuring out what it means and how to troubleshoot it, and it's not coming up in any searches. It happens immediately after trying to build to a device (no scripts compile, etc):
error: Unable to load contents of file list: '/Users/.../Products/Debug-appletvos/myapp.app/Info.plist' (in target 'myapp')
Full log below, (note I've replaced build folder with ... for brevity)
Showing Recent Messages
Prepare build
note: Using new build systemnote: Planning buildnote: Constructing build description
Build system information
error: Unable to load contents of file list: '/Users/.../Products/Debug-appletvos/myapp.app/Info.plist' (in target 'myapp')
Build failed 3/5/19, 3:09 PM 0.2 seconds
Things I've tried so far:
Restarting Xcode
Restarting Computer
'Product' > 'Clean Build Folder'
Manually deleting everything in Build folder
Re-download repository on the same computer (same issue)
Re-download repository on a different computer (same issue)
reverting to a previous commit that was working (same issue)
plutil Info.plist responds with Info.plist: OK
Other items of note:
Project uses Cocoapods
Project utilizes custom C++ code
The only file list in the Info.plist file is a list of 2 custom fonts, but those are showing up ok in the Xcode project browser (not red).
If anyone has encountered this before and has a fix, or has any other suggestions for troubleshooting I would greatly appreciate it, thanks!
In my case, I just fixed below
Open terminal under project folder
pod deintegrate
sudo gem install cocoapods-clean
pod clean
Open the project and delete (if it's still there) the “Pods” folder that should be red
pod setup (This may take some time)
pod install
I fix this in this way:
1、Go to your project's target, -> Build Phases -> Embed Pods Frameworks
2、check the input files and input file lists, Output files, and output file lists.
3、move dir from input file lists to input files, and output file lists to output files
I realised after a while that my colleague has updated cocoapods to the latest version, so what I did was just
sudo gem install cocoapods
And that did the trick! :)
Finally figured this out, posting here so others googling can find it.
It was an issue with a build script that used the 'Input File Lists' option, removing and re-adding the script fixed the issue.
Nav to Target
'Build Phases' tab
'Run Script' phase
make notes of what's there, remove it
re-run to make sure things work
re-add the script (and content under 'Input File Lists')
The problem is that you have added path to Input File Lists instead of Input Files
In my case
pod deintegrate
pod install
was enough
In my case, I just fixed below
1- Go to your project's target, -> Build Phases -> Delete [CP] Copy Pods Resources.
2- pod deintegrate.
3- pod install.
First, you work:
Delete the .xcworkspace file
Delete the Podfile.lock file and Pods/ directory
Keep the Podfile
Rerun pod install
If the error still occurs, you need to add include .xcconfig path for CocoaPods in your .xcconfig files by prepending an #include statement like the following: #include “Pods/[path .xccofig file in Terminal”
Example:
I have two environments Stag and Production
After I run the pod file in Terminal. You’ll see in Terminal that CocoaPods did not set the configuration since we already set custom configurations. CocoaPods provides a link to be included in each
Open .xcworkspace file and select .xcconfig file
Finally, Cmd + Shift + K and run project
Good luck!!!
No need to deintegrate pods and install again. Just run
pod install
It will create necessary files for new configurations.
In my case, Xcode was using a Build Configuration that didn't exist anymore. Going to 'edit scheme...' and selecting a valid scheme fixed it for me.
In my case, the problem wasn't about cocoapods, it was about Fabric
I removed row $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) from Build Phases > Fabric > Input File Lists and it fixed the error

React Native - .xcworkspace doesn't contain any files after pulling from git

I've just pulled my latest commits at home, run npm install and then get some issues running react-native run-ios:
xcodebuild: error: The workspace named "Contractor" does not contain a scheme named "Contractor". The "-list" option can be used to find the names of the schemes in the workspace.
When I opened up the .xcworkspace in XCode there's nothing in the project navigator sidebar and no schemes. If I open up the .xcodeproj file, all of my source files are there, so it seems like there's been some disconnect between the workspace and the project?
I'm not really sure where to go from here..
Are you using cocoapods? I ran into the same issue, cd PROJECT_ROOT/ios && pod install fix it for me.

iOS - not sure how to properly update cocoapods configuration for iOS 7

I had cocoapods in my project and it worked fine. But now that I upgraded my xCode and everything else, I get a linker error about the pods when I try to archive the project.
I was trying to follow the solutions in this answer but the steps they mention are not quite what I see on my screen.
What are the steps to configure my cocoapods correctly?
Here is a screenshot of how things are appearing for me with the libraries in red on the left side, and some configurations on the main area of the screen.
Make a backup of your .pod config file that has all your third party project references in it. Delete pods folder and delete workspace that Cocopods creates by default.
This is the file to backup
$ sudo gem install cocoapods
Navigate to where project lives:
cd /Users/yourUserFolder/LocationOfProject/
Then Run:
$ pod install
Open Workspace
$ open App.xcworkspace
**Make sure you open the workspace file. Not the .project file.
Image of what my .pod file looks like, just for your reference to make sure you have the correct format.

Resources