ionic4 app generate iOS files without www folder - xcode

I'm using ionic CLI version 4.12.0 to create an app, when I use this command ionic Cordova platform add ios
ionic CLI adding the Xcode files of my App, but when I run the App on the real device I get this error
ERROR: Start Page at 'www/index.html' was not found.
and
Internal navigation rejected - <allow-navigation> not set for url='about:blank'
I think my ionic CLI does not generate the www folder files like in ionic3 CLI, is there something missing. www folder is totally empty and not shown in Xcode files

As pointed out in the comments ionic cordova platform add ios will only download the needed tools for iOS.
To build the www directory, run ionic cordova prepare ios after adding the platform.
According to the docs, ionic cordova prepare ios does the following:
Perform an Ionic build, which compiles web assets to www/.
Copy the www/ directory into your Cordova platforms.
Transform config.xml into platform-specific manifest files.
Copy icons and splash screens from resources/ to into your Cordova platforms.
Copy plugin files into specified platforms.

Related

shared preferences don't work on ios [Xcode Debug]

I am trying to save the data locally in my application trying to use the shared preferences, while on android and chrome everything is ok, on ios by problems. When I debug with xcode this warning comes out "shared_preferences_ios not found".
Follow this steps
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run

Cloud Firestore not working only on iOS | Flutter

I tried to add to my flutter app services like firebase and Firestore.
I've already done this on windows, now I am on Mac.
I followed the official guide at this link
When I build the android app it works fine, but on iOS I keep getting errors like this
How can I fix this?
Already tried to disable 'Use map Header' option, and to boot on legacy emulator.
I have the following configuration for Firestore in iOS:
pubspec.yaml
firebase_core: ^0.4.1+3
cloud_firestore: ^0.12.10
# other dependencies
execute the following command:
flutter pub get
Download the GoogleService-Info.plist file, and copy it to the path nameApp/ios/Runner
Update Firebase with the command: pod update Firebase
NOTE: at some point in a project I had problems with firestore and what I had to do was the following, execute command flutter clean
in the following link it can be a video on youtube where they make an explanation of the firebase configuration for iOS link

Error ENOENT: no such file or directory, scandir 'PATH_PORJECT\platforms\android\app\src\main\res'

I have an error I have a when running tns platform add android command.
I can run other apps (new apps) but no my current and all happens after I install codeworks_android it change the path for the SDK then I reinstall native-script but I'm not able to add the Android platform.
CODEWORKS
error ENOENT: no such file or directory, scandir 'PATH_PORJECT\platforms\android\app\src\main\res'
Adding the platform would help (For both Android and iOS),
tns platform add ios
tns platform add android
More explanation in Doc here
If the platform already exists(you can check inside the platforms folder), you can try remove/clean before adding again,
tns platform remove android
tns platform clean android
If you are using the Nativescript seed project (like NS advanced seed), make sure you are in mobile app's root folder(typically nativesctript inside the projects root folder) when you add or remove the platforms.
Adding the solution as an answer here with little more information (instead of an update in the comment) so others can get it easily.
These commands solved my problem
npm i
ns run android

Unable to run the Sencha Cordova project in Windows 8.1 Computer

I have downloaded the sample Sencha project from Lee in her blog (Lee's Sample Project).
I have installed all the necessary software like Sencha Cmd version 5.0.1.231 , Ruby, Compass, sass, Java, Node.js,Sencha Touch, Cordova in my windows 8.1 machine before proceeding to work.
I have followed the steps from this answer (Answer Link)
When I run the following Sencha Command inside the Sencha Project which I downloaded.
sencha app build package
It says the project builds on older version of Sencha, Please Upgrade to new Sencha Cmd Version.
so I have run the following Command.
sencha app upgrade
After that ,I repeated the step 1, i.e, I run the same command
sencha app build package
I have created a new folder namely LeeCode inside my tomcat webapps directory.
Now I have copied all the files inside my sencha project and pasted it inside LeeCode folder.
After doing the above step ,I have opened Chorme Browser and type http://localhost:8080/LeeCode
I was able to see that the project is working fine in Chrome browser.
Now I have created new Cordova project by issuing the following command in command prompt.
cordova create LeeCodeCordova
Then I have added the platform by using the following command,
cordova platform add windows
Then I have removed all content of www folder in my cordova project.
Now I have copied the Sencha files from LeeCode folder (which is inside my Tomcat webapps directory).
Then I have run the following command
Cordova build windows
Then I have run the following command
Cordova run windows -- --win
I was able only to see the first screen after that it hangs , I was not able to see the next screen in Cordova, but if run the same project as mentioned in chrome , I was able to all the screens in the project.

Trouble packaging and signing iOS apps built with Cordova CLI

Until now, all of my experience compiling PhoneGap apps has been via the excellent PhoneGap:Build service. However, I now find myself in a situation where I need to compile locally, because I need to use a plugin that includes a binary file, which precludes it from being included for use with PG:B.
So for these reasons, I need to compile locally. "Great!" I thought, I'll just use the new CLI...
I have developed my app, and I can test it on-device via deploy over USB from Xcode, but trying to get a release build, and sign it, with the provisioning profile embedded, has been a nightmare.
For completeness, this is the basic outline of everything I've done, aside from the app development itself.
$ pwd
/users/adam/dev/myapp/mobile/
$ cordova create build_local com.foo.bar MyApp
Creating a new cordova project with name "MyApp" and id "com.foo.bar" at location "/Users/adam/DEV/myapp/build_local"
$ cd build_local
$ cordova platform add ios
Creating ios project...
$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.foo.bar
Name: MyApp
Android target: android-19
Copying template files...
<snip>
Project successfully created.
$ cordova plugin add https://github.com/hazemhagrass/BackgroundJS
Fetching plugin "https://github.com/hazemhagrass/BackgroundJS" via git clone
Installing com.badrit.BackgroundJS (android)
Fetching plugin "https://github.com/apache/cordova-plugin-device.git" via git clone
Installing org.apache.cordova.device (android)
Installing com.badrit.BackgroundJS (ios)
Installing org.apache.cordova.device (ios)
$ cordova plugin add de.appplant.cordova.plugin.local-notification
Fetching plugin "de.appplant.cordova.plugin.local-notification" via plugin registry
Installing de.appplant.cordova.plugin.local-notification (android)
Installing de.appplant.cordova.plugin.local-notification (ios)
$ cordova plugin add https://github.com/kdzwinel/phonegap-estimotebeacons
Fetching plugin "https://github.com/kdzwinel/phonegap-estimotebeacons" via git clone
Installing pl.makingwaves.estimotebeacons (android)
Installing pl.makingwaves.estimotebeacons (ios)
For what it's worth, this last plugin is the reason that I have to compile locally.
Now, here's one other potential monkey wrench: This app is actually two apps. It's the same core codebase, merged into two different deployment branches of the repo, one for each client. So each app will have its own id, name, and config stuff. Because of this, I actually have more than one cordova project folder (1 for each final app) and after creating each project through the steps above, I remove the generated www folder and replace it with a symlink to the shared www folder that exists outside of these phonegap project directories.
This is supported behavior; the CLI allows you to generate your app with a symlink via the --link-to flag (see cordova help create for details). However, doing so seems to have issues; so I've resorted to doing all of the app config up front and then replacing the generated www folder with a symlink after everything is ready to compile.
At this point, I can deploy to either the iOS simulator or Android emulator, and I can deploy to devices over USB, and everything works just fine; all of my plugins are available and function as expected. So I'm ready to compile a release build. Android is easy. iOS, not so much.
$ cordova build ios
<snip>
** BUILD SUCCEEDED **
However, this is a DEV build. The generated file is in the build/emulator/ folder, and when I attempt to sign it, I'm told that it's not signed because of the I386 architecture (which indicates that it's a development build).
$ xcrun -sdk iphoneos PackageApplication -v "platforms/ios/build/emulator/MyApp.app" -o "/users/adam/dev/myapp/MyApp.ipa" --sign "iPhone Distribution: {our cert name} ({our cert id})"
<snip>
Codesign check fails : platforms/ios/build/emulator/MyApp.app: code object is not signed at all
In architecture: i386
<snip>
I've attempted to generate a release build from the cordova CLI. I haven't been able to find the --release flag documented anywhere, but the CLI doesn't complain, and it usually does if it doesn't recognize a flag.
$ cordova build ios --release
<same result as previously>
Attempting to sign this build results in the same problem.
At this point, I started attempting to work directly in Xcode. I've set the .mobileprovision file and the signing credentials up appropriately, to the best of my knowledge:
With these values set, Xcode no longer allows me to build:
So I'm stuck: I have no choice but to build locally, and I can't figure out how to get it to build for release and sign! Please help!
Additionally, if I attempt to embed a provisioning profile, that fails because of an issue with entitlements. I'm not exactly sure what this means, but I'm hopeful that it's a result of working with a dev build, and resolving that will resolve this as well.
$ test -e ~/.ios/DEV.mobileprovision && echo exists
exists
$ xcrun -sdk iphoneos PackageApplication -v "platforms/ios/build/emulator/MyApp.app" -o "/users/adam/dev/myapp/MyApp.ipa" --embed "~/.ios/DEV.mobileprovision"
<snip>
error: Failed to read entitlements from '/var/folders/zs/j2hmt69n12sbjm6gyn0m_q4c0000gn/T/tyYvYPQKf3/Payload/MyApp.app'
Update 1:
This SO question helped in one regard. I don't know how the active scheme (I'm not really sure what that means, but that's the tooltip when I hover over the control) got changed as part of specifying keys/etc, but clearly it did. Changing this back to an iOS Device, like iPhone, allows me to build my project, and even Archive (which, to the best of my understanding, means it's creating the .ipa file I need to submit to the app store), but I can't find the archived file. Where should it be? Can I define this in a setting somewhere in Xcode?
Update 2:
By fiddling with certificates and provisioning profiles I've finally been able to create an archive from Xcode, which I've been told is a release build (is it?). Ideally I would like to be able to build from the command line so that I can automate it as much as possible, so that's where I'll be picking up in the morning. Any advice on that front would be quite welcome!
If you managed to create an archive in Xcode, then your signing certificate and provisioning profiles are known to Xcode, so cordova build ios --release --device should make it.
The steps are:
1) Import your iOS developer certificate for production to the keychain by downloading and double clicking on it in Finder (or get it via Xcode)
2) Download your provisioning profile (with the App ID set to the id attribute of the widget element in config.xml) and double click it on Finder so it goes to the Xcode provisioning profile store
3) cordova build ios --release --device
it looks like you're trying to sign the app with a wildcard provisioning profile (the XCode screenshot). Can you try creating and downloading a distribution certificate and provprofile to your Mac? Then import the .cer file in the keychain access app (doubleclicking should suffice) and doubleclick the provprofile as well.
Now you should be able to select the appropriate values from the release dropdowns in the XCode build settings.
Hope this helps somewhat...
Eddy
One other issue I am seeing from your screenshot is I don't think you can Build an Archive (Release) version using the Developer Signing Idenetity, you would need to create a Distribution certificate and use that one for the Release (Archive) version.

Resources