My iOS build of my app does not seem to want to connect to the internet at all. Can someone point me in the right direction with this?
I've added the address that I am trying to connect to, to the white list. Though I am not sure where to start with this as this is my first iOS app. I'm not sure if there is an error generated some where that I'm not seeing.
The app builds fine and is pushed to both the Simulator and a physical iPhone. It works on the Simulator. The iPhone has a connection and can browse the web so I know that is not the issue.
Let me know what else you may need to help with this as I'm not sure what I need to provide.
Edit
Below script logs the user into the system using a backbone.js model which sends an ajax request to the server. This works fine on the Android Build.
App.user = new App.model.user({
'email' : $(event.currentTarget).find('#email').val(),
'password' : $(event.currentTarget).find('#password').val()
});
The user model:
App.model.user = Backbone.Model.extend({
defaults : {
"email" : null,
"password" : null,
},
initialize : function () {
this.save(null, {
success : function (model, response) {
App.loggedIn = true;
App.navigate("menu", {
trigger : true,
replace : true
});
App.menu();
},
error : function (model, response) {
try {
App.mainView.error(response.resultMessage);
} catch (e) {
console.log(e);
}
},
wait : true
});
},
urlRoot : App.config.siteUrl + "/gateway/user"
});
I would try the following.
1) Have a dummy html page
< html>
< head>
< script>
window.location.href="Your absolute URL you are trying to reach"
< /script>
< /head>
< body>Loading< /body>
< /html>
If that does not work, set whitelist to * and try again. If it works something wrong in the way whitelist is set
2) See if you are accessing a secure URL. If it works on simulator and doesn't work on phone, see if the phone has access to the URL you are trying to hit. Try using mobile safari.
3) Make sure you are using right cordova file. (The cordova.js is different between Android and IOS)
4) If mobile safari is able to connect, they try using the webview debugger as specified in this awesome post
I think you have to fix you Cordova.plist :
http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html
Related
I've got my suite to run against two different browsers by setting my config file to use a desktop and mobile device:
{
name: 'firefox - Desktop',
use: {
...devices['Desktop Firefox'],
},
},
{
name: 'Mobile Safari - Portrait',
use: {
...devices['iPhone 12'],
},
},
Is it possible to get which device is being used in a test? The site being tested is responsive so things like images might be visible on desktop but not on mobile so I need a way to put a condition in my test to assert it's visible if desktop but not if mobile.
Update:
For anyone else who asks this, you can use isMobile https://playwright.dev/docs/api/class-browser#browser-new-context-option-is-mobile
e.g.
test('MyTest', async ({ page, isMobile }) => {
// isMobile returns a boolean depending if a mobile browser / device is used.
}
https://playwright.dev/docs/api/class-browser#browser-new-context-option-is-mobile
This can be called in a test and returns a boolean.
Firstly : i went through many ( MANY ) post about this problem, tested them all, but it seems that i'm cursed, or something like that ?
I'm working on expo with the LAN method, on iOs.
My back is on .Net Core 3.
My iPhone is on the same Wifi than my computer.
And my computer is running my .Net back server.
I found at that localhost cannot be handle by expo/react-native. So i tried the IP adresse method and change my back adress and the adress that my front was trying to fetch.
Tried the infoPlist with expo. Tried some mysterious things that i don't fully understood with my .Net server. Also tried to turn off my firewall, it didn't change anything.
Well, i'm not used to post because existing posts often answer my question.
Here is my code about my fetch method :
export async function callPlanning() {
try {
let response = await fetch(
"http://my.Ipv4.adress:myApiPort/myRoute",
);
let responseJson = await response.json();
return responseJson;
} catch (error) {
console.error(error);
}
}
My Api is working well on Postman.
And i can call the facebook test api with this function within my app.
Here is my app code where i'm calling this fetch function :
export default class BetaserieScreen extends Component {
constructor(props) {
super(props)
this.state={
response: null,
};
this.askPlanning = this.askPlanning.bind(this);
}
askPlanning = () => {
this.setState({
response: Back.callPlanning(),
})
}
render() {
return (
<View style={styles.MainContainer}>
<Text> Beta Serie </Text>
<TouchableHighlight onPress={this.askPlanning}>
<Text>Planning</Text>
</TouchableHighlight>
</View>
);
}
}
If you see anything that could andwer my question or about my code : i'll take it.
I'm on it for 2 days, and i've to find a solution...
If you need any other information about my system or file about my project, feel free to ask for it if you think you can help me with this problem.
I'll be glad.
the reason is ios blocks the requests made with http protocol by default
check in here https://reactnative.dev/docs/network
Is there any way to fetch user’s phone number in Firefox OS?
If so, any help would be appreciated.
According to Mozilla's app permissions page, there is an permission called "phonenumberservice" but there is no information about it. Anyway, the permision is listed under the "Internal (Certified) app permissions", which means that, when available, it can only be used by "system-level apps and default apps created by Mozilla/operators/OEMs".
With Firefox 2.0 you should be able to use Mobile Identity API:
https://wiki.mozilla.org/WebAPI/MobileIdentity
https://bugzilla.mozilla.org/show_bug.cgi?id=1021594
I believe the permission is:
"permissions": {
"mobileid": {} }
And it is privileged.
So, as #Jason said, the Mobile Identity API provides this capability, and not just for certified, but for privileged applications. So it is no longer just for OEMs.
The Mozilla Wiki site shows the API:
dictionary MobileIdOptions {
boolean forceSelection = false;
};
partial interface Navigator {
Promise getMobileIdAssertion(optional MobileIdOptions options);
};
The site also provides a sample code skeleton for this:
function verifyAssertion(aAssertion) {
// Make use of the remote verification API
// and return the verified msisdn.
// NB: This is necessary to make sure that the user *really* controls this phone number!
}
// Request a mobile identity assertion and force the chrome UI to
// allow the user to change a possible previous selection.
navigator.getMobileIdAssertion({ forceSelection: true })
.then(
(assertion) => {
verifyAssertion(assertion)
.then(
(msisdn) => {
// Do stuff with the msisdn.
}
);
},
(error) {
// Process error.
};
);
For this to work, you need to add the mobileid permission in the manifest file, for example like this (I made up the description):
"permissions": {
"mobileid": {
"description": "Required for sending SMS for two factor authentication",
"access": "readonly"
}
}
PS: I made this answer, because most answers are outdated, and the one that isn't, does not contain all useful information.
References:
App Manifest Documentation
Firefox Remote Verification
I have an app written in HTML5, Javascript, css3 using PhoneGap to compile for iOS and Android. It collects survey information and uploads this via Ajax call to online host. It has been working really well until recently the upload code appeared to stop working. WELL NOT QUITE! On the iPad it says successful but in fact nothing ever makes it to the host. This is VERY strange. I've tried re-writing the Ajax call based on articles on here but no luck.
iOS - 6.1.3, PhoneGAP 2.7.0, PhoneGap/Adobe Build used.
This is the upload piece...
function sendToWeb(){
var errorflag = false;
db.transaction(function (tx) {
tx.executeSql("SELECT weburl FROM settings", [], function(tx, results){
var webURL = results.rows.item(0).weburl;
tx.executeSql("SELECT * FROM surveypretransfer WHERE uploaded = '0'",[], function(tx, results){
if (results.rows.length == 0) {
alert("You have no surveys waiting to upload");
} else {
alert("You have " + results.rows.length + " surveys waiting to upload");
for (var i=0; i < results.rows.length; i++) {
var responseURL = webURL + "/feeds/saveinfo.php";
var responseString = results.rows.item(i).responsestring;
var localid = results.rows.item(i).id;
//alert(localid);
$.ajax({
type: 'POST',
data: responseString,
url: responseURL,
timeout: 30000,
success: function(data) {
alert('Success!' + data.join('\n'));
},
error: function(data) {
alert(data.join('\n'));
console.log("Results: " + localid);
alert("Error during Upload. Error is: "+ data.statusText);
}
}); //ajax
}; //for loop
alert("You have successfully uploaded "+ results.rows.length + " survey results");
tx.executeSql("UPDATE surveypretransfer SET uploaded = '1' WHERE uploaded = '0'");
}; //if statement
}); //tx.execute
});
}, errorCB);
}
Neither of the two alerts fire when loaded on iPad. Works fine on Android and has previously worked on iPad so I can't find what has changed.
UPDATE: Appears that this only applies to WiFi only iPads. All the 3G ones I tested were fine. Figure that!
Config.XML contains app id = "com.mydomain.myapp" (as an example)
URL for upload is "http://customer.mydomain.com/feeds/saveinfo.php?..."
Also added line 'access origin="http://mydomain.com" subdomains="true" '
Still no results. Is anyone seeing/having similar issues? Anyone see my mistake?
For iOS you might want to try <access origin="http://*.mydomain.com" />, as iOS is not documented in the PhoneGap API to support the subdomain property.
If that doesn't solve your issues, you will probably want to look into CORS (Cross Origin Resource Sharing). I had issues trying to do a POST request from my app to a local port on iOS. The W3C has a great article on how to enable CORS that will probably help. I know in my case, the system would attempt to do an OPTIONS request first, and if it didn't work, the whole thing would fail.
Another tool that you will probably find useful (if not now, in the future) is Fiddler. You can set up an iPad to proxy through your desktop, and then you will be able to observe all of the requests going to and from the device. This is how I found the OPTIONS request noted above.
I would like to embed an external website in my app, so I tried it with the tag here:
<iframe src="http://www.uniteich.at" frameborder="0" width="420" height="315"></iframe>
But I get the following error: "Unsafe JavaScript attempt to access frame with URL content://io.trigger.forge2dd999d0f14b11e1bc8612313d1adcbe/src/index.html from frame with URL http://www.uniteich.at/. Domains, protocols and ports must match."
So is there a good solution to embed a website in ios/android app with trigger.io?
Thanks in advance,
enne
EDIT: Ok, to make it more clear what I want: I would just like to load an external website as soon as a user clicks on a specific tabbar button at the bottom. I made this event-handler:
var dessertButton = forge.tabbar.addButton({
text: "Uniteich",
icon: "img/strawberry.png",
index: 2
}, function (button) {
button.onPressed.addListener(function () {
//LOAD EXTERNAL WEBSITE IN CONTENT CONTAINER HERE
});
});
Is that possible somehow?
This issue is cross domain requests. For more information read the same origin policy.
To get around this you will need to utilize forge.request. After adding www.uniteich.at to your config permissions first try the simple forge.get like this:
button.onPressed.addListener(function () {
var mainElement = document.getElementById("main");
forge.request.get("http://www.uniteich.at/index.html", function(content) {
mainElement.innerHTML = content;
},
function(error) {
mainElement.innerHTML = "<b>Error</b>" + error.message;
});
});
And if that does not work or not enough (I am not at my dev computer right now) you can utilize more options with forge.request.ajax.