Why pincolor property is giving me an error with ti.map? - titanium

I am trying to include an annotation on ti.maps module on Titanium sdk 5.1.1.GA, but I am getting this error:
message = "+[MKPinAnnotationView redPinColor]: unrecognized selector sent to class 0x10c2bb4e0";
has iOS updated MKPinAnnotationView ?, because it worked fine a couple days ago, and I took exactly the same code as in the official docs http://docs.appcelerator.com/platform/latest/#!/api/Modules.Map
So the code I am running is :
var Map = require('ti.map');
var win = Titanium.UI.createWindow();
var mountainView = Map.createAnnotation({
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters",
subtitle:'Mountain View, CA',
pincolor:Map.ANNOTATION_RED,
myid:1 // Custom property to uniquely identify this annotation.
});
var mapview = Map.createView({
mapType: Map.NORMAL_TYPE,
region: {latitude:33.74511, longitude:-84.38993,
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
regionFit:true,
userLocation:true,
annotations:[mountainView]
});
var circle = Map.createCircle({
center: { latitude: 33.74511, longitude: -84.38993 },
radius: 1000, //1km
fillColor: "#20FF0000"
});
mapview.addCircle(circle);
win.add(mapview);
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt) {
Ti.API.info("Clicked " + evt.clicksource + " on " + evt.latitude + "," + evt.longitude);
});
win.open();
Does anyone has the same problem?
EDIT:
I think I found the problem, correct me if I am wrong it seems to be Titanium map module will be only supported with iOS SDK 9?, according with these changes : https://github.com/appcelerator-modules/ti.map/pull/127/files

If you're using TiSDK 5.1.# or higher, you should compile with Xcode 7. It might be that certain features are also iOS 9+, but should not fail to compile
I notice in the Apple Docs the pincolor feature has also changed in iOS 9, so it could be your map module is not yet up-to-date, or the map module has not been fitted with the latest iOS change, but I think that not to be true.
Update your ti.map module to the latest! You can find it here: http://gitt.io/component/ti.map

Related

How to add image from mobile storage to mapbox-gl?

I've been trying to add an image overlay to mapbox-gl-js on a project that uses Ionic 5 + Vue.js, similar to what Leaflet does, but i cannot get it to work.
The only way that I can get it to work is by following this tutorial, but the image does not fit properly into the polygon. I've also tried this, and I can see when Capacitor requests the image, but it does not load. It works fine on Chrome, but on mobile it does not.
This is the code that I have now:
const { map } = this;
if (map.getLayer(layerId)) {
map.removeLayer(layerId);
}
if (map.getSource(sourceId)) {
map.removeSource(sourceId);
}
map.addSource(sourceId, { ...source, url: Capacitor.convertFileSrc(source.url) });
map.addLayer(layer);
whereas the source and layer objects are like this:
const sourceId = `${talhao.id}-image`;
const layerId = `${talhao.id}-image-${image.id}`;
const bbox = getBoundingBox(talhao);
const source = {
type: "image",
url: image.imagemPng,
coordinates: [
bbox.getNorthWest().toArray(),
bbox.getNorthEast().toArray(),
bbox.getSouthEast().toArray(),
bbox.getSouthWest().toArray()
]
};
const layer = {
id: layerId,
source: sourceId,
type: "raster",
paint: {
"raster-opacity": 0.85
}
};
Any help would be appreciated!
edit: It is worth noticing that I do not think that the image is the problem here, because I use the same image in another part of the screen that I'm working and it loads fine.
Turns out the mapbox-gl-js library had a bug in version 1.x that prevented the image from showing on mobile.
Upgraded to version 2.0.1 and it worked.

How do I set the glyphimage of a MapKit annotation?

I know this is basic stuff but the documentation online is thin. I am new to Apple Mapkit and I am trying to create a simple annotation with a glyphImage overlay. I have the annotation working, but when I try to set the glyphImage the map blows up. The code I am using is:
testAnnotation.glyphImage = UIImage(named: "/public/img/site/tester.png");
What am I doing wrong here?
I figured this out:
var testAnnotation = new MarkerAnnotation(test, {
title: "This is a Test!",
subtitle: "Testing Apple MapKit",
glyphImage: {
1: "/images/testimage.png"
}
});

How to access external Storage in Tizen Smart TVs

I need yout help to find out how to write and read files from external usb storage from Tizen Smart TVs. Problem starts when detecting it
`
/**
* Hello World Sample Project
*/
// import Label component
var Label = caph.require('ui.base.component.Label');
caph.app.addScene('main', $class({
$extends : caph.require('ui.base.Scene'),
// oncreate is called when the scene is created
oncreate : function() {
// add "Hello World"
this.addChild(new Label({
text : 'Hello World',
size : [ 500, 100 ],
position : [ 300, 400 ]
}).setTextSize('72px').setStyle({
backgroundColor : 'red',
color : 'white'
}));
/// Here the filesystem showd show me all the storages
tizen.filesystem.listStorages(checkCorruptedRemovableDrives);
}
})).run();
`
And here is the Success callback, this show me how much storages I have.
`
/* Success event handler */
var checkCorruptedRemovableDrives = function(storages) {
/// Here I will kow how much storages I have
console.log(storages.length);
for (var i = 0; i < storages.length; i++) {
if (storages[i].type != "EXTERNAL")
continue;
if (storages[i].state == "UNMOUNTABLE")
console.log("External drive " + storages[i].label + " is corrupted.");
}
};
`
Here is the method thrown when there are errors, this is never called.
var checkCorruptedRemovableDrivesError = function(storages){
console.log("Error");
}
Now, the console output is aways a simple 0 meanning I have no storage (but I have the internal one and two usb ones mounted).
Has Anyone faced this problem or have any Idea on how to solve it?
Samsung Tizen TV always uses "removable2" as label for USB.
So you don't need to use listStorage and getStorage.
Multiple USBs are distinguished as "removable2/sda1", "removable2/sda2"
tizen.filesystem.resolve("removable2", function(e){
e.listFiles(function(r){
for(i = 0; i < r.length; i++){
tizen.filesystem.resolve(r[i].path + r[i].name, function(t){
//You resolve USB root. Do something you want with USB.
}, function(t){
console.log("resolve error for " + r[i].path + r[i].name);
console.log(t);
}, "rw"); //you should use rw permission, to write something in usb.
}
});
},function(e){
console.log("removable2 resolve error");
console.log(e);
}, "r"); // permission should be given as r for removable2
Here is test app made by me. and you can check how to use SDK 1.5
http://www.samsungdforum.com/SamsungDForum/ForumView/3ad8bd6023af18a7?forumID=d88a711f47dc6e9f
This app is working in both of TV and SDK 1.5
Do you use Web Simulator?
APIs don't work in Web Simulator properly. It can't simulate things well.
When I check listStorage in 'emulator', it throws list of storages.
but even though I can get list of storage, I can't use it in filesystem. It is bug of SDK 1.4.
SDK 1.5 will have test features for USB storage, and it is planned to release in a month. Wait for a month :(

Javascript Style Sheet in Titanium mobile

I'm a learning mobile development using Titanium Mobile framework.
I am facing a problem related to application of javascript style sheet.
When I name my jss file same as the js file, to which the style is to be applied, it works fine. But if I name it something else, it don't work. Can anybody tell me a solution. Following is my code sample.
// app.js
var win = Titanium.UI.createWindow({ backgroundColor : '#fff' });
win.add( Ti.UI.createButton({ title : 'Button A' }) );
win.open();
// app.jss, works fine
button { backgroundImage: 'grdadient_img.png'; }
// button_style.jss, don't work
button { backgroundImage: 'grdadient_img.png'; }
I never had much success using more than one JSS file. And if you follow Nandu's links you'll see that it's not really documented very well, likely to be removed from Titanium at some point. I expect that Titanium's Alloy will kill off JSS too.
If you don't want to use JSS (or Alloy yet), there is a neat way to centralise your styles using commonJS modules and optionally underscore.js e.g.
theme.js
var theme = {
tableLabel : {
color : '#3285C7',
backgroundColor : 'transparent',
inactiveColor : '#AAAAAA'
}
}
module.exports = theme;
to use
var theme = require('ui/common/Theme');
...
var myLabel = Ti.UI.createLabel(_.extend({}, theme.tableLabel, {
top : 5,
height : Ti.UI.SIZE,
width : Ti.UI.FILL,
text : "Hello world",
}));
I use _extend to take the settings from the theme and add instance specific settings like size, position etc. Don't forget the first empty object literal in the call to `_.extend()
See http://underscorejs.org/#extend
Ammar, please refer the following links. Hope it will help you
1.How to use jss correctly
2.How Does .jss feature really works in Titanium mobile SDK

Sencha touch 2.0 Calendar Plugin Run Issues in production, package and device

I have implemented this calendar in my app developed in sencha touch 2.0 and I face a problem.When I run my application source code in a web browser, Calendar works fine. But when I generate the production & package of the app the calendar not work and following issues occur.Moreover these issues also occur when app run in a device:
1): Cell not select in the month view of calendar.
2): Next and Previous not work in the month, week and day view of calendar.
3): This seems to me that on tap events cannot get bind
Example :
this.element.on({
tap: this.onTableHeaderTap,
scope: this,
delegate: 'td'
});
this.element.on({
tap: this.onTimeSlotTap,
scope: this,
delegate: this.getItemSelector()
});
Please help me to get rid of this hurdle.
I shall be very thank full to you.
Create your class obj like this and add this in your child class constructor:
companyCalender = Ext.create('myapp.view.TouchCalendarView',{
viewConfig : {
mode : 'month',
weekStart : 0,
value : new Date()
}
});
Ext.apply(this.initialConfig, config);
Ext.apply(this, config);
myapp.view.CompanyCalender.superclass.constructor.apply(this, arguments);
this.add(companyCalender);