an-rahulpandey / cordova-plugin-dbcopy

Copy SQLite Database from www folder to default app database location
Apache License 2.0
89 stars 48 forks source link

iOS support #33

Closed MehdiGuelloub closed 7 years ago

MehdiGuelloub commented 8 years ago

Using the following code, everything works correctly on android but on ios even the alerts are not firing!!

window.plugins.sqlDB.copy("mydba.db", 0, function() { $rootScope.base = $cordovaSQLite.openDB({name: "mydba.db", location: 'default'}); alert('Copied'); }, function(error) { alert(error.message); $rootScope.base = $cordovaSQLite.openDB({name: "mydba.db", location: 'default'}); });

Am I doing something wrong or does the plugin don't support ios?

PS: tested on ipad and iphone

an-rahulpandey commented 8 years ago

Do you have any Xcode log? Or is there any error printed out?

MehdiGuelloub commented 8 years ago

No no errors on Xcode, nothing to report from the log. Everything looks fine, just the above script is totally ignored !

MehdiGuelloub commented 8 years ago

This is the Xcode log:


2016-10-12 17:10:52.828 MErial[919:303659] Apache Cordova native platform version 4.0.1 is starting.
2016-10-12 17:10:52.831 MErial[919:303659] Multi-tasking -> Device: YES, App: YES
2016-10-12 17:10:53.151 MErial[919:303659] Using UIWebView
2016-10-12 17:10:53.156 MErial[919:303659] [CDVTimer][handleopenurl] 0.568986ms
2016-10-12 17:10:53.164 MErial[919:303659] [CDVTimer][intentandnavigationfilter] 7.458985ms
2016-10-12 17:10:53.165 MErial[919:303659] [CDVTimer][gesturehandler] 0.433028ms
2016-10-12 17:10:53.198 MErial[919:303659] [CDVTimer][splashscreen] 31.865001ms
2016-10-12 17:10:53.225 MErial[919:303659] [CDVTimer][statusbar] 26.979983ms
2016-10-12 17:10:53.230 MErial[919:303659] [CDVTimer][keyboard] 4.759967ms
2016-10-12 17:10:53.231 MErial[919:303659] [CDVTimer][TotalPluginStartup] 75.142026ms
2016-10-12 17:10:59.182 MErial[919:303659] Resetting plugins due to page load.
2016-10-12 17:11:01.760 MErial[919:303659] THREAD WARNING: ['Device'] took '15.752197' ms. Plugin should use a background thread.
2016-10-12 17:11:01.912 MErial[919:303659] Finished load of: file:///var/containers/Bundle/Application/B31F77F9-5C99-4F7A-BA53-946964A3A0AD/MErial.app/www/index.html#/app/map
an-rahulpandey commented 8 years ago

Do a cordova build first using command line and make sure the function where you have written the dbcopy code gets called.

northeastrc commented 7 years ago

Did this get resolved i get no rule to process the plugin

Warning no rule to process file '/Users/rc/.taco_home/remote-builds/taco-remote/builds/9022/cordovaApp/platforms/ios/fmap/Plugins/cordova-plugin-dbcopy/sqlDB.h' of type sourcecode.c.h for architecture i386

an-rahulpandey commented 7 years ago

You can remove this warning by following this steps - 1) Open Xcode 2) Select the project target 3) Click on the Build Phases tab 4) Select and Expand Compile Source section 5) Check if sqlDB.h file is present, if it is present then select it and remove it.

northeastrc commented 7 years ago

i removed it but it keeps giving me the error also i cant see two new tables i added to my sqlite db in ios i can see them perfectly on android

an-rahulpandey commented 7 years ago

@northeastrc it will be a waring not an error. You can google this "type sourcecode.c.h for architecture i386" to get more insight on that message. Make sure you are have uploaded the db properly in iOS, check the database with Sqlite Browser. If the app is already present on device and previously the db is copied, then the second time it will not copy the db again, it will go to error function. So you have to check that too, if the app was deleted from that device first or use removedb function to delete the old db.