首先:感谢几天前我从你们那里得到了如此好的和快速的反馈。
我仍在使用 Tabris 0.11 并尝试像你们在演示项目中那样实现地理定位。
在 Android 上一切正常,但在 iOS(iPhone 5)下我得到了错误
EXC_BAD_ACCESS (code=1, address=0xbbadbeef)
这是我的代码的样子
public void create( Composite parent, UIContext context ) {
// creation of the layout types
createLayouts();
parent.setLayout( GridLayoutFactory.fillDefaults().margins( 0, 0 ).spacing( 0, 0 ).create() );
createContainer( parent );
createBrowser();
}
private void createLayouts() {
layoutGrid = new GridLayout();
layoutGrid.numColumns = 1;
layoutGridData = new GridData();
layoutGridData.horizontalAlignment = GridData.FILL;
}
private void createContainer( Composite parent ) {
[...]
containerBrowser = new Composite( parent, SWT.NONE );
containerBrowser.setLayout( layoutGrid );
containerBrowser.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
[...]
}
private void createBrowser() {
browser = new Browser( containerBrowser, SWT.NONE );
browser.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
lastLat = 48.775418;
lastLon = 9.181759;
setBrowserUrl( lastLat, lastLon);
}
private void setBrowserUrl( double lat, double lon) {
StringBuilder builder = new StringBuilder();
builder.append( "http://open.mapquestapi.com/staticmap/v4/getmap" );
builder.append( "?size=" + 200 + "," + 200 );
builder.append( "&zoom=16" );
lastLat = lat;
lastLon = lon;
builder.append( "¢er=" + lat + "," + lon );
builder.append( "&imageType=png" );
if( lastLabel != null ) {
builder.append( "&pois=" + lastLabel + "," + lat + "," + lon + ",0,0" );
}
browser.setUrl( builder.toString() );
}
我在iOS方面没有真正的经验,希望这些信息对你们有所帮助。
在此先感谢,托比