cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
264 stars 318 forks source link

ionic ios integration #231

Open mibzman opened 7 years ago

mibzman commented 7 years ago

I am attempting to use this plugin in an ios application. From what I can tell it looks like this plugin is currently broken for ios, with no clearly documented fix.

Swift Version: 3.1
Ionic-cli Version: 3.0.0-rc.2
OSx Version: 10.12.4

Steps to reproduce:

ionic start test
cd test
ionic cordova plugin add cordova-plugin-geofence

Open config.xml and add:

    <preference name="UseLegacySwiftLanguageVersion" value="true" />
    <preference name="swift-version" value="2.3" />

run:

ionic cordova platform add ios
ionic cordova run ios

Result: dump.txt

I realize that this is obviously related to #215 #211 and #222. I would have no problem 4.) Go into xCode & find edit > convert > To Current Swift Syntax, but I am unable to follow this instruction.

How to I open these files in xcode? /test/plugins/cordova-plugin-geofence/src/ios doesn't have a .xcodeproj file so xCode won't open those files.

I tried replacing those files following the instruction here, but re-running ionic cordova run ios had no effect, even when I remove the contents completely.

I'm also seeing the same issue with the ionic2 sample, but with no resolution there either.

Based on the comments I'm seeing, I'm sure someone has a fix to this issue, It just hasn't been clearly posted yet.

mibzman commented 7 years ago

I've fixed this issue for my project by switching to a fork of this project.

ionic cordova plugin add https://github.com/ypelud/cordova-plugin-geofence
sudo ionic cordova platform rm ios
ionic cordova platform add ios

I haven't done extensive testing to see if all functionality is the same, but I'm hopeful. Hopefully someday @ypelud's fork will be merged so the project compiles out of the box.

mibzman commented 7 years ago

For the record the xcodeproj for ionic projects is located in <project_name>/platforms/ios/<project_name>/ and the specific files are in <project_name>/platforms/ios/<project_name>/Plugins/cordova-plugin-geofence

mibzman commented 7 years ago

here is the procedure that eventually worked for me:

ionic cordova start testApp
cd testApp
ionic cordova plugin add cordova-plugin-geofence
ionic cordova platform add ios
cd testApp/platforms/ios/testApp/Plugins/cordova-plugin-geofence

replace the files there with the files here

open testApp/platforms/ios/testApp/.xcodeproj in xcode (if this is not a brand-new project, you should clear the xcode build cache with command+option+shift+k) edit->convert->to current swift syntax

build-> fails find offending line and replace with

return self.number?.intValue
ionic cordova run ios