allow-navigation isn't taking precedence over allow-intent on iOS - ios

I generated an iOS and Android Pollyfill for my PWA app with PWAbuilder. It is working great on Android, but I'm running into an issue on the iOS one.
I want external links to open in the external browser, so I added this allow-intent:
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
This worked fine, if I click on any external link (not-under-my-domain.com), it opens in the external browser.
For opening my-domain.com within the app, I added
<allow-navigation hap-rule="yes" href="*://my-domain.com/*" />
According to the docs, allow-navigation should take precedence over allow-intent, but it does not seem to be working.
Then if I click on any link within my domain, such as /other-page, it opens in the external browser - which isn't expected, it should open within the app.
I would like to have any link not defined in allow-navigation to open in the external browser, and all others (under my-domain.com) within the app.
Any ideas?

So after all it seems the problem was with my outdated version of cordova. I upgraded the cordova version following #jcesarmobile's suggestion on the comments and it is working now.
npm install cordova -g
cordova plugin save
cordova platform rm ios
cordova platform add ios

Related

firebase social login not redirected to the app , ionic 3 , ios

I am trying to implement social login in my ionic 3 app with the help of 'firebase' authentication.
I followed this artical https://javebratt.com/ionic-social-login-firebase/
I installed all the plugins(cordova-plugin-browsertab,cordova-plugin-inappbrowser ..etc)
and did exactly same as in the article.
Then I ran the app on both android and ios devices.
in android device the facebook/google login page is opened in the 'in app browser' and it is redirected to the app successfully after the login process.everything works fine.
But in the iPhone the facebook/google login pages are opened in a new safari browser instance and after the login it redirect to localhost, and it is not redirected back to the application.
can anyone help me with this?
thank you
I believe the issue is related to ionic in iOS now defaulting to WKWebView (http://ionicframework.com/docs/wkwebview/) which has issues with Firebase.
ionic native app URLs in iOS now appear as http://localhost instead of file://assets/.../index.html.
The suggested workaround at this time is to downgrade to UIWebView.
Firebase Auth is looking into a solution for this.
I had the same issue, and changing the webview engine didn't solve it for me.
What worked for me was to add
<allow-navigation href="http://*" />
to config.xml.
I guess this worked for me because that localhost:8080/... link works over http, but I only had https://* allowed in my config.xml before that.
Not sure though why this is not an issue on Android, but hope this helps!
I have the same issue. I have followed all the steps described in https://firebase.google.com/docs/auth/web/cordova?authuser=2 but in ios it does not work (in Android all is working fine). I think it is related with the 'customurlscheme' property because this is the property that contains the app name that has to be reopened, but I have checked all the places where I am using it and all seems to be correct (I modified the package name of my app and I think this could be related with the issue).
I will try to fix it, if I find the solution I will let you know.
I don't have the required "rep" to comment on bojeil's answer above... but to expand on his answer:
Adding:
<preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
to the config fixed this issue for me.
You will need to edit your config.xml.
This line will allow you to be redirected back to your app.
<allow-navigation href="*" />
This line will solve the disallowed user agent screen
<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" />

Branch.io Cordova SDK not generating links

I am trying to integrate Branch.io into my mobile app, mostly for the purpose of tracking and rewarding referrals. I have the plugin mostly working, but it is failing at the most important part, generating the links. The app successfully initiates Branch, creates a Universal Object and I get a confirmation alert every time the app opens. It also successfully opens the share sheet when I click the share button and fills in the message text, but it doesn't contain the link. I've also noticed that the Branch.io dashboard is not recognizing that I've integrated the SDK. I am using PhoneGap build 6.2.0 and Cordova Branch SDK version 2.6.0
Here is my the Branch snippet of my config.xml
<plugin name="branch-cordova-sdk" spec="^2.6.0" /><!-- If available via Cordova registry; consider changing to an NPM reference. -->
<branch-config>
<branch-key value="key_live_xxxx" />
<uri-scheme value="xxxx" />
<link-domain value="xxxx.app.link" />
<ios-team-release value="xxxx" />
</branch-config>
And here's a screen shot of the alert after creating a universal object and of the share sheet
Universal Object
Share Sheet
It Is the issue with PGB Service
i had same issue with my project also... i am taking build using phonegap build service. universal object is initializing but the link is not generating.. in ios 9.3 the Share sheet comes. but there is no link . in ios 10 even Share sheet is not opening
Try Using Mac with cordova my issue solved
check this link ..
https://forums.adobe.com/thread/2290461

Embedded Twitter timeline in PhoneGap 3.1.0 application

I have an issue with integrating Twitter timeline with PhoneGap 3.1.0 application (iOS version)
1) I have generated a new PhoneGap 3.1.0 application
2) Have added iOS version
3) I have generated a timeline widget in Twitter
4) Have pasted the code from Twitter widget into the page:
index.html:
<a class="twitter-timeline" href="https://twitter.com/bill_hallam" data-widget-id="399136844954087424">Tweets by #bill_hallam</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
5) Have whitelisted twitter domains:
config.xml:
<access origin="https://twitter.com" subdomains="true" />
<access origin="http://twitter.com" subdomains="true" />
<access origin="http://platform.twitter.com" />
<access origin="https://platform.twitter.com" />
<access origin="https://cdn.syndication.twimg.com" />
<access origin="http://cdn.syndication.twimg.com" />
6) Started the iOS emulator from Xcode
Result: The page is blank. Safari Develop console shows that twitter <iframe> tag is embedded in the page. All js/css files retrieved successfully. None if them was blacklisted.
Does anyone have succesfull experience integrating Twitter timeline into PhoneGap 3.1 app?
Update Nov 29 2016
This is most probably not the issue the OP faced back then, but if anyone faces the same issue these days (using Cordova 6.4.0, as of Nov 29 2016), the answer is to add:
<allow-navigation href="about:*" />
to your config.xml.
This is required to be able to open the about:blank URL initially used by the iframe set up by the Twitter timeline widget.
I have finally figured out a way to do that.
Unfortunately at the moment the only solution I have found is using an InAppBrowser plugin.
But it works for both - iOS and Android versions.
The detailed description is here
I have created a small public page, that functions as a service.

Phonegap 3.1 won't load external content, despite it being explicitly set

I realise this is a common problem and has been asked many times, however I do feel that no other answers work in this instance.
I have a basic PhoneGap application that works fine in browser, on the Android simulator, on Android devices in the XCode/iOS simulator. It does not work, however, on iOS devices. When adding external libraries the app essentially hangs. It doesn't crash, but tries to load it forever more, leaving a blank white screen.
I know this is a common problem, fixed by amending the config.xml to whitelist URLs, which I believe I have done, but I still get the same problem.
My config.xml has the following entry:
<access origin="*" subdomains="true" />
I have also tried the following:
<access origin="*" />
<access origin="*" subdomains="true" />
<access origin=".*" />
<access origin=".*" subdomains="true" />
All together and on their own, with no luck. After building to iOS (phonegap local build ios) I have also 'prepared' all of the plugins (cordova prepare).
I have tried several libraries, from various CDNs such as Google CDN and jQuery CDN. I have also tried adding an iframe with the following:
<iframe src="http://google.co.uk" width="250" height="500"></iframe>
Which gives me a blank iframe.
If I look at the build in XCode and look at the generated platform-specific config.xml files I can see the same access XML as expected.
I am using the below versions:
Phonegap 3.1.0-0.15.0
XCode 5.0
OSX 10.8.5
iOS 6.1.3 (iPod Touch)
iOS Simulator for iOS 7
Any help is much appreciated.

Add facebook iOS SDK without Xcode for a Phonegap Build app

I've been able to successfully build my iOS app without using Xcode. My app is a collection of HTML, CSS, and Javascript, along with my config.xml that I'm able to compile with Phonegap Build.
The app's basic functionality has been tested on iPhones and works well, but now I want to add a social layer to the app with the FacebookConnect plugin for Phonegap Build. However, the documentation on GitHub requires the app to be setup in Xcode.
Without using Xcode, is there a way to download the SDK (not as a .pkg) and add it to my project files that I upload to Phonegap Build to complile? If so, where do I get the files, which files do I need, and where do I include these files in my project structure?
Here is my current project structure:
-config.xml
-index.html
-includes
--css
--js
Perhaps there is a way of doing this with GitHub, but I've never done pull requests or anything like that. I simply work in my text editor and am not sure how to pull from GitHub.
Phonegap Build Plugins
Thank you for any help you can offer on this!
I have successfully implemented the FacebookConnect Plugin for Phonegap Build on Windows without Xcode.
I recommend just following the instructions on the Phonegap Build Plugins page and ignore the instructions on the GitHub page (which talks about Xcode and other things you don't need for the Build plugin). They have now updated the GitHub page instructions to direct Phonegap Build users away from the GitHub instructions and over to the Phonegap Build Plugins page.
For Step 1 (Setting your app up on facebook), select Native iOS App and the Bundle ID is the same as your "id" in your config.xml (i.e. com.company.appname) and you can set the App Store IDs to "0" while testing.
For Step 2, make sure you use facebook-js-sdk.js. At one time there was a typo.
A good way to test things out is to paste the content of the example Simple app on GitHub into a new index.html file and upload it with your normal config.xml file to Phonegap Build . I did this for one build on my app and then after I tested it, just uploaded my normal index.html file. The only change you will need to make in the index.html of the Example app is to put your Facebook App ID at the bottom in the FB.init function. I also changed response.session to response.authResponse to match the Facebook JS SDK, but I'm not sure if that is necessary.
Be sure to update your config.xml file with everything mentioned in Step 3. I also added the following code:
<access origin="http://m.facebook.com" />
<access origin="http://graph.facebook.com" />
<access origin="http://api.facebook.com" />
<access origin="http://fbcdn.net" subdomains="true" />
<access origin="http://akamaihd.net" subdomains="true" />
The above code is not necessary if you have the following in your config.xml file already:
<access origin="*" />
The FacebookConnect plugin is using the Facebook JS SDK, which you can learn more about here: https://developers.facebook.com/docs/reference/javascript/.
Also, one other issue I ran into that the Phonegap Build Team is working on is that when asking for permissions, you cannot just ask for the Basic Permissions by leaving off the scope option. For now, you must include at least one scope option for the login function to work.
function fbLogin () {
FB.login(function(response) {
if (response.authResponse) {
alert('User Login Success!');
} else {
alert('User cancelled login or did not fully authorize.');
}
}, { scope: "email" });
}
Most developers probably want to ask for more than the Basic Permissions, so this shouldn't be that big of an issue.
My responses above are from discussions about the Facebook Plugin over on the Phonegap Build Support Site. You can learn more about the plugin and current issues and solutions there.
It took me a little while to figure this stuff out, so hopefully this will help others save some time.

Resources