SpatialDBKit icon indicating copy to clipboard operation
SpatialDBKit copied to clipboard

EXC_BAD_ACCESS on spatialite_init(TRUE)

Open davidchiles opened this issue 11 years ago • 5 comments

I made a completely new project to make sure.

Steps

  • Create new iOS Xcode Project
  • Create Podfile
platform :ios, '6.0'

target 'example' do

pod 'SpatialDBKit', '~> 0.1'

end

target 'exampleTests' do

end
  • pod install
  • rename main.m to main.mm
  • Replace line 87 of spatial.c with #include <spatialite/spatialite/spatialite.h>
  • Add #import <spatialite.h> to SpatialDatabase.m because of build errors
  • In AppDelegate.m
#import "AppDelegate.h"
#import <SpatialDBKit/SpatialDatabase.h>

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"db.sqlite"];
    SpatialDatabase *database = [[SpatialDatabase alloc] initWithPath:filePath];

    return YES;
}
  • Run

Result

Crash on line 114 of spatialite_init.c EXC_BAD_ACCESS

sqlite3_auto_extension ((void (*)(void)) init_spatialite_extension);

davidchiles avatar Dec 03 '14 04:12 davidchiles

I pulled the latest changes into a fork and that seemed to fix the issue.

Maybe update the podspec?

davidchiles avatar Dec 03 '14 05:12 davidchiles

ugh. I am not using myself this project since some time, so maybe something broken in the meanwhile. This seems to be the culprit: https://github.com/davidchiles/SpatialDBKit/commit/cffcdc8d73344d96f2ce4b1aeaad89109c7b5d02

I will integrate it ASAP, thank you for pointing it out!

andreacremaschi avatar Dec 03 '14 11:12 andreacremaschi

But it still does not work. You must use the file 'spatialDatabase.m' in the example project to replace the corresponding file in your project.Then you will see that it works!

zhangyuning1 avatar Jun 14 '16 08:06 zhangyuning1

但是它仍然不起作用。 您必须在示例项目中使用文件'spatialDatabase.m'来替换项目中的相应文件,然后您会看到它起作用了!

Hi, I did as you said, but still reported this error, can you direct me? I use swift5 and xcode11.

Antlers777 avatar Sep 03 '20 05:09 Antlers777

When I use the SpatialDBKit added by cocoapods, I first report an error of "cstddef" I can't find it. I will go to geo_ c.h . The program starts to crash when it runs. I want to get help. I use swift5 and Xcode 11

Antlers777 avatar Sep 03 '20 05:09 Antlers777