EXC_BAD_ACCESS on spatialite_init(TRUE)
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.mtomain.mm - Replace line
87ofspatial.cwith#include <spatialite/spatialite/spatialite.h> - Add
#import <spatialite.h>toSpatialDatabase.mbecause 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);
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!
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!
但是它仍然不起作用。 您必须在示例项目中使用文件'spatialDatabase.m'来替换项目中的相应文件,然后您会看到它起作用了!
Hi, I did as you said, but still reported this error, can you direct me? I use swift5 and xcode11.
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