Ionic live reload feature not reloading application - ionic-framework

I tried to use live reload feature with ionic serve and ionic emulate ios --livereload. Server starts well, application is displayed on simulator (or in browser) and it works smoothly.
When I change a file (a js or html in www directory) and save it, console write HTML changed: www/index.html for example, but application doesn't reload itself as it should be.
I supposed that websocket between server and app could be broken, but when I kill the server (Ctrl-C), web inspector immediatly fire the following error :
[Error] WebSocket network error: The operation couldn’t be completed. Connection refused (192.168.5.2, line 0, x4)
So I supposed that there is no issue with websocket. Moreover, it is displayed with no error in Network pane of web inspector.
Is there something I missed to made livereload work ?
My configuration :
Cordova CLI: 5.0.0
Ionic Version: 1.0.0
Ionic CLI Version: 1.4.5
Ionic App Lib Version: 0.0.22
ios-deploy version: 1.7.0
ios-sim version: 3.1.1
OS: Mac OS X Yosemite
Node Version: v0.10.30
Xcode version: Xcode 6.3.2 Build version 6D2105
Don't hesitate to ask me for clarification if something is not clear.
Edit
I also tested it without Internet connection at all to check if it was a firewall issue or something like that, but it changes nothing.

Try running ionic address and selecting the correct interface.
If it doesn't work and it's iOS 9, it may be an issue with Apple ATS:
https://github.com/driftyco/ionic-cli/issues/605
It could also be a CORS issue. In this case, try installing the cordova-white-list plugin.

I solved this doing this:
Go to https://update.ionic.zone/
Copy the content of your package.json in the input tab.
Then click in the update button
Copy the content of the output tab and paste replacing the content of your package.json
Save the file, and run npm install
When the updates are finish just run ionic serve and it should be works fine again
;)

I have faced such a problem, tried a fresh new app, worked perfectly, tried another old app, also worked perfectly.
Tried to stop using some modules (clipboard in my case and another one), solved the problem, in my case it was an error in the way I am importing or using it.
Hope this will help someone

Related

How to get Ionic Pro Deploy to download latest version on first app open

Problem
When I release a new version to the production channel in Ionic Pro Deploy (Channels) then I have to cycle my app twice in order to get the latest version. Even worse, on the first cycle my app reverts back to a far earlier version for some reason.
What I mean by cycling is, starting from a state where the application is shut down and not open, I open the app, wait for the splash screen to go away and app to be ready, and then close the app.
Question
How do I get my app to download the latest version on the very next time I open the Ionic app following my production release?
Plugin configuration
I used the plugin config from the dashboard.ionicjs.com page:
cordova plugin add cordova-plugin-ionic --save \
--variable APP_ID="[myappid]" \
--variable CHANNEL_NAME="Production" \
--variable UPDATE_METHOD="background"
Execute the command you already showed but set UPDATE_METHOD to "auto"
If you wand more control over your updating methods have a look at this:
https://ionicframework.com/docs/pro/deploy/plugin-api.html
In my case, live deploy worked correctly on a "blank" Ionic project. Live deploy also worked correctly on "my" app on iOS but not on Android.
I followed the follow steps and successfully fixed Android. However, during this process iOS suddenly had the same problem (would apply update on app install/close/open).
Set versions as per Ionic support. IonicPro live deploy currently requires these versions. Ionic are in the process of fixing this dependency:
"cordova-plugin-ionic-webview": "1.1.19",
"cordova-plugin-ionic": "4.1.7",
Install a new version of "blank" project. Update my app to use the same npm plugin versions (some of my app plugins were old).
Remove/add android platform. My hunch is this is what ultimately resolved the issue.
I wanted to try a remove/add ios platform to see if that also resolved the issue on iOS. But it was less work to ultimately switch over to IonicPro rather than re-config the local build setup.
Live deploy worked correctly on both iOS and Android after creating binaries in IonicPro.

Ionic serve / ionic run not reflecting changes

Both ionic serve and ionic run are not reflecting any of my latest changes. ionic serve is showing them from a few hours ago, and ionic run is showing them from about an hour later. Since then, I've discarded all my changes, and created a new branch from the parent--yet it's still showing those same versions from a few hours ago on the first branch. In short, there's code showing up that I don't have in any files in this, or any, branch. And no uncommitted changes.
Your system information:
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.10.1
Xcode version: Xcode 8.3.1 Build version 8E1000a
I've tried things including ionic state restore and ionic state reset as well as removing and adding platforms back manually.
Also, this is what shows up in my console currently:
Static file server running # http://localhost:8000/index.html
CTRL + C to shut down
200 /service-worker.js
Whereas it previously displayed a list of html, css, etc. requests when the page loaded. Currently, I can make it work as expected by unregistering and removing all ServiceWorkers at chrome://serviceworker-internals/ and chrome://inspect/#service-workers
#stephen, it's been some time now, but I faced a similar issue before. Turns out I had registered the service worker that ships with projects created with the CLI, check your index.html and see if the lines that register the service worker are commented out. If they are you may be having a different problem, if they aren't and you didn't plan to use a service worker, comment them out again, and on your browser (you said chrome), after running ionic serve, open "Inspect" (Ctrl+Shift+I), go to the "Application" tab - "Service Workers" and unregister it.
This happens because the service worker that ships with new projects created using the cli will cache all resources, next time you update your code the browser will load the previous version, that's why you don't see the changes.
Hope it helps
Open the developer console, right click on the button to reload the page and click on empty cache and reload in a forced way (Last option).

DeviceInfo native module is not installed correctly

So I tried implementing Facebook Login and followed all the steps accordingly. After having errors with FBSDKcorekit/FBSDKcorekit.h' file not found, I decided to pivot over to working on other components.
Lo' and behold, I have this error giving me trouble now. I followed along with this video: https://www.youtube.com/watch?v=rAXVKapP5cM&t=458s where I used the react-native install react-native-fbsdk and react-native link react-native-fbsdk commands in my terminal.
If it helps, I'm getting the following compile error in my terminal:
The following build commands failed:
CompileC /Users/someUser/desiredProject/ios/build/Build/Intermediates/RCTFBSDK.build/Debug-iphonesimulator/RCTFBSDK.build/Objects-normal/x86_64/RCTFBSDKGraphRequestManager.o RCTFBSDK/core/RCTFBSDKGraphRequestManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
I'm not sure if it was the tinkering around with the react-native-fbsdk or making links to it that caused this error. Note my project was working before I was trying to implement Facebook Login and using the link command.
What's going on here?
Thanks in advance for your time and patience.
edit: Also I did not implement any of the Facebook login code yet since I couldn't get a successful build on Xcode.
#kdizzle Make sure you have the right packager running in the terminal, sometimes you may have a packager associated with another react native project running, this happens because when you stop running an xcode RN project, it doesn't stop the packager in the terminal, and when you start/open another RN project in xcode, it simply checks if a packager is running, doesn't check if it's associated with the current project. So make sure you stop all of the packager instances in the terminal and then open the RN project again.
This may happen when upgrading a project to a newer version of react-native. To fix it,
Stop your packager.
Quit your iOS/android simulator.
Reinstall your modules: rm -rf node_modules && npm install
Restart your packager and simulator, e.g. react-native run-ios
I had this issue and it happened when I changed Hardware within the simulator. To fix it I had to kill the packager and run 'react-native run-ios' again. It didn't happen all the time but when it did this fixed it for me!
Another use is in a Brownfield App. Check your iOS and/or Android react-native versions. If they don't match exactly you will see this error screen too.
For example: I had a react native instance running 0.45.1 while Android had 0.45.0 installed. The solution for me was to make sure everything was running the same version.
None of the above answers have worked for me, so I researched the 'react-native' options a little and ended up:
Deleting the iOS and android folders from the app directory altogether
Running 'react-native eject'
Re-running 'react-native run-ios'
After that the iPhone emulator seemed to have no problem with the app.
This problem would appear when React Native libraries in ios project can not found.
I happend to meet this problem when i update my react-native version from 0.42 to 0.44, and cause that a file named RCTConvert+Map disappear in 0.44, so i update my pod.
command: pod update

My Ionic app works fine on browser but does not open in my phone

my ionic project works fine with ionic serve --lab ,but while copied the.apk file in build folder to my phone and install the app but blank screen appears ,
Please can anyone suggest what might be my problem
my app is using google maps,key is provieded for both app and browser in index.html
Have you tried running it in the emulator ? Since its much easier to see the error logs . Try ionic emulate android -l or ios -l (whichever OS you are building for) and then once the execution starts run the command consolelogs it will log all the activity and you will have a better understanding about why its not working.
+1 for using Chrome Remote Debugging feature. It give you the same output as you would receive from running you app in the browser.
Additionally, I have found that sometimes if your app is already compiled, the ionic CLI doesnt always copy your current files into the APK, and uses the older cached files instead. If you are banging your head against the wall, run the following commands to make sure you have your latest code in your APK.
ionic platform remove android
ionic platform add android
ionic run android
I suggest you use the Chrome Remote Debugging feature. I encountered the same, and looked for answers to my symptom for hours. Once I connected to the chrome remote debugger, I got the console.log back, and noticed there was a problem in my routing setup.
It was a problem with ionic CLI. I've updated it to the latest and reinstalled all dependencies.

Blackberry webview can not connect to internet and/or display a web page

I am creating a simple app using Eclipse and Blackberry JRE 7.0 as per the example given at:
http://docs.blackberry.com/en/developers/deliverables/11958/Configure_a_browser_field_825671_11.jsp
I am trying to load a simple HTML page hosted on a remote server inside browser field in the app.
When running the app on 9930 Simulator I always get the error 'Local connection timeout after 120000 on simulator'. The same remote page shows up fine on the web browser of the same simulator..
I am making sure to start the MDS simulator.
The same link shows up fine in simulator browser. Its only when using browserfield, I am having the problem.
I get the folling error when clicking the icon to launch the app:
Error displaying content for: http://yahoo.com
Error message: java.lang.runtimeException:ApplicationRegistry:wai​tFor
(0xd0fe7d7338fourd7f0d) timeout
....
On waiting further I get the 'Local connection timeout error..
I know that in Android one has to enable internet connection when using the webview in the manifest file - is there any similar setting one has to do in blackberry?
I tried to run the BrowserField demo app on 9930 (JRE 7.0.0) and encounter the same issues as you did. On the other hand, the demo worked fine on 9800 (JRE 6.0.0). I tried again on 9930 and noticed that though I definitely enabled MDS (enabled the 'Launch Mobile Data System Connection Service (MDS-CS) with simulator' in the Run/Debug Configurations in Eclipse), the MDS window didn't appear which seemed very strange.
I googled a little and found this post on BlackBerry's forums. According to this post:
An incorrect version of MDS-CS simulator was included in 7.0. To correct it you can delete it and copy the version from 6.0.
Well done, RIM!
Then, I deleted the MDS folder from JRE 7.0.0 and copied the one from JRE 6.0.0 as described in the aforementioned post. Closed and rerun simulator and voilà, the MDS window appeared. Rerun application, and everything worked like a charm!