I have the following html;
<div id="map_canvas"></div>
and if have some js;
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady () {
navigator.notification.alert("Yup, it works!",function(){},"","");
navigator.geolocation.getCurrentPosition(getCurrentPositionSuccess, getCurrentPositionError);
};
function getCurrentPositionSuccess(position) {
alert(123);
//alert(position.coords.latitude);
currentPosition = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
gmap = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 15,
center: currentPosition,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
}
Obviously all the above is a snip but all the key players are in place.
All this worked great on my PC and using Safari. However, when I moved over to the mac, xcode and phonegap, the map no longer displays.
alert(123) never happens and the getCurrentPositionError function is called.
The error is code 2, kclerrordomain error 0
I get the alert that the app want's to use my location though.
Any help here would be great.
I am using xcode 5.0.1 on Mavericks with phonegap 3.1 for iPad.
edit
If I use the Retina simulator I can get back the location but not if i use the ipad sim. Why would that be?
Related
I am working on titanium app that is using camera for taking pictures. After taking around 15+ pictures the app will crash. I found the same problem reported on Appcelerator Titanium side https://jira.appcelerator.org/browse/TIMOB-24389, https://jira.appcelerator.org/browse/AC-6225 but I cannot see a solution there. I tried what is suggested there but that is not fixing the problem.
Here is also some simple app.
Steps:
1.Click "Add photo" button
2.Take picture
3.Click "Use Photo"
4.Repeat steps 15+ times.
App crashes during the process of taking picture.
Tested with different devices and different Titanium SDKs, it can be reproduced every time.
var win = Ti.UI.createWindow({});
var view = Ti.UI.createView({});
var button = Ti.UI.createButton({
color : '#000000',
title : "Add photo",
height : 'auto',
width : 'auto'
});
view.add(button);
button.addEventListener('click', function(e) {
showCamera();
});
function showCamera() {
Titanium.Media.showCamera({
showControls : true,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
autorotate : true,
success : function(event) {
},
error : function(error) {
},
cancel : function() {
}
});
}
win.add(view);
win.open();
Does anyone know some workaround how can I avoid this crashing?
Thanks.
I used to have this SAME issue for a long time.
For iOS, you’ll need to set the <use-jscore-framework> flag to true in the tiapp.xml file.
This flag is enabled by default in Titanium SDK 7.0.0 and later.
https://jira.appcelerator.org/browse/TIMOB-24206
I am facing an issue.
I need my electron app always placed at the top with full-width and other windows should be placed under it.
How can I do this?
anyone can help me to solve this issue?
You should use mainWindow.maximize() to display full width screen.
function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1366,
height: 783,
alwaysOnTop:true //display show on top
})
// and load the index.html of the app.
mainWindow.loadFile('index.html');
// Emitted when the window is closed.
mainWindow.on('closed', function () {
mainWindow = null
})
mainWindow.maximize() //call like this way
}
You can get more reference from here
I have a Mac OS X application and am using a WebView (webkit) to embed a YouTube iframe.
For some reason it keeps pausing on certain videos after a few seconds. It will just get stuck loading.
Flash NPAPI Plug-in version 18.0.0.160 is installed.
Xcode is also throwing an Error: Ignoring controlTimebase set by client because AVSampleBufferDisplayLayer was added to a synchronizer
Here is my code for the iFrame embed, the same one as YouTube provides.
<div id="ytplayer"></div>
<script>
document.body.setAttribute("style", "margin-left:0px;margin-top:0px;background-color:#000000");
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('ytplayer', {
height: '200',
width: '300',
videoId: '%#',
playerVars: {
'controls': 0,
'html5': 1,
'autoplay': 1
}
});
}
</script>
It was working fine until a couple days ago. I believe YouTube might have updated something, which could just mean the error is on their end.
I have the following script code designed to capture double tap events so I can toggle an image between a size that fits on the page and full size. The problem is that the tap event is not firing at all in Safari browser running on iPhone 4. In the below code, the alert never displays regardless of what I do on the touch screen.
$(function () {
$('#showImage').on('tap', function (event) {
alert("gets in tap event");
var d = new Date();
var tapTime = d.getTime();
if (tapTime - lastTapTime > 500) {
lastTapTime = tapTime;
}
else {
toggleResize();
}
});
});
Why isn't this working?
tap event is now working. I had some script code on an earlier page that was breaking the script code on this page. When I removed the earlier script code, this script code started working again.
I am trying to access the parent window of an iframe and set the iframe's height.
The following code works on Windows IE7/IE8/Chrome/FireFox 3.6 and on Mac FireFox/Safari.
But on Mac Chrome it doesn't appear to be accessing the parent window.
On the parent page I have an iframe:
<iframe src="iframe_saleinfo.html" id="saleInformationIframe" frameborder="0"></iframe>
In the iframe.html:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', window.top.document);
theFrame.height($(document.body).height() + 30);
});
I have also tried:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', top.document);
theFrame.height($(document.body).height() + 30);
});
And I've tried:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', parent.document.body);
theFrame.height($(document.body).height() + 30);
});
And I tried:
$(document).ready(function() {
var theFrame = $('#saleInformationIframe', window.parent.document);
theFrame.height($(document.body).height() + 30);
});
Thanks in advance,
Jayde.
It looks like a local issue with Chrome Mac. I don't have a web server installed on the test mac but when I uploaded the files to a server and viewed it from there, everything appears to work.
Thanks,
Jayde.