小编Mic*_*ele的帖子

iOS Google Maps SDK,无法收听GMSMarker点击事件

我坚持使用适用于iOS的GoogleMaps SDK ...
我想在Google地图上点击GMSMarker时添加一些功能,但它不起作用.有什么不对?

FirstController.h

#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
#import <CoreLocation/CoreLocation.h>
#import "sqlite3.h"

@interface FirstViewController : UIViewController <CLLocationManagerDelegate,
                                                  GMSMapViewDelegate>
{
    sqlite3 *db;
}
Run Code Online (Sandbox Code Playgroud)

FirstController.m

[...]

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    camera = [GMSCameraPosition cameraWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude zoom:(12)];
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    mapView_.myLocationEnabled = YES;

    for(GMSMarker *currentMarker in _locationMarkers)
    {
        currentMarker.map = mapView_;
    }

    self.view = mapView_;
}


-(BOOL) mapView:(GMSMapView *) mapView didTapMarker:(GMSMarker *)marker
{
    NSLog(@"try");
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

google-maps-markers ios google-maps-sdk-ios

5
推荐指数
1
解决办法
1万
查看次数

反转PHP文件()函数

我使用file()函数将.php文件转换为数组.
现在我修改了数组,我想将所有内容放回文件中(保持行结尾)...
有人可以告诉我是否有一个与file()相反的函数?
我想绕过恼人的"数组到字符串转换"的方式......

提前致谢!

php arrays newline file

3
推荐指数
1
解决办法
650
查看次数

将db从资产复制到设备数据文件夹时出现FileNotFoundException

我试过很多方法将我的sqlite db文件复制到我的/ data/data/packagename/databases文件夹,但是我仍然陷入FileNotFoundException,由FileOutputStream对象触发...这是代码:

public static boolean checkCopyDb(Context c, DbHandler _db) {
    try {
        String destPath = "/data/data/" + c.getPackageName() + "/databases/db_sociallibraries.db";

        File dbFile = new File(destPath);

        if(!dbFile.exists()) {
            _db.copyDb(c.getAssets().open(DB_NAME), new FileOutputStream(destPath)); // Line 44 - Throws the exception
        }
        return true;
    }
    catch (IOException e) {
        e.printStackTrace();
        return false;
    }
}

private void copyDb(InputStream inputStream, OutputStream outputStream) throws IOException {

    byte[] buffer = new byte[1024];
    int length;

    while((length = inputStream.read(buffer)) > 0) {
        outputStream.write(buffer,0,length);
    }

    inputStream.close();
    outputStream.close();
}
Run Code Online (Sandbox Code Playgroud)

这是错误:

02-09 …

sqlite android assets filenotfoundexception fileoutputstream

1
推荐指数
1
解决办法
2826
查看次数