cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
265 stars 316 forks source link

Requires swift 3.0 in Xcode 8.3 #215

Open seed880505 opened 7 years ago

seed880505 commented 7 years ago

Swift 2.3 is not supported and can not be built in Xcode 8.3 with the new iOS SDK 10.3.

VierenV commented 7 years ago

Same issue after updating Xcode today 😕

rafialikhan commented 7 years ago

Try the update from here - https://github.com/ypelud/cordova-plugin-geofence/tree/d2e1f22340ac2cd07559598fd290df462e75055d/src/ios

Just copy paste the contents of the 3 files (GeoFencePlugin.swift , SwiftData.swift, SwiftyJson.swift) into your XCode build where you notice build errors for these 3 files and build again.

Till @tsubik - merges this here or Yann makes a release available, the above copy/paste is a working solution.

seed880505 commented 7 years ago

@rafialikhan Yes, thanks for sharing what you have found. Swift is really my pain. I will have a try after updating to Xcode 8.3. If anyone already succeeded, you can post here your progress for sharing.

StephanGieffers commented 7 years ago

@rafialikhan thanks! your fix worked. I was able to compile after the following steps:

Let's cross fingers, the code is still working - and that I do not have to rebuild the project...

thoeunuch commented 7 years ago

@StephanGieffers I was able to compile 1 week ago and now I'm getting errors. Has anyone else gotten this to work? Please help!

compelling commented 7 years ago

Hi, I just compiled my app with the plugin with success - when opening the project in xcode, it asks if i would like to convert the code to swift 3. I click Convert. It then compiles with 2 errors. I then copy paste the 3 files from https://github.com/ypelud/cordova-plugin-geofence/tree/d2e1f22340ac2cd07559598fd290df462e75055d/src/ios into xcode and can then compile my app. The geofences seem to work as they should. Would be nice if the plugin was released on npmjs again with the fixes - they work fine for me.

josh-m-sharpe commented 7 years ago

These files also worked for me, except I think I've been able to skip the step of having xcode convert things:

1) add \ 2) add \ 3) do not add preference tag for 'UseLegacySwiftLanguageVersion' 4) cordova platform add ios (installs plugin, etc) 5) swap three files above into place (platforms/ios//Plugins/cordova-plugin-geofence/) 6) build your app - no swift errors/conversion necessary

lpender commented 7 years ago

@josh-m-sharpe Check steps 1 and 2 above... 😮

lpender commented 7 years ago

I need use the branch mentioned above plus the following steps:

Add:

#import "Geofence-Plugin-Bridging-Header.h"`

ToBridging-Header.h

lpender commented 7 years ago

I believe this project needs something along the lines of

https://github.com/meteor/cordova-plugin-meteor-webapp/blob/dd2d61589c27fe41c56778cb9f7bfab41a612fbd/scripts/iosAddBridgingHeader.js

curlybracketsSARL commented 7 years ago

I am getting plugin not installed after following the steps above... Any idea? This is happening right after I replace the files from the other Yann's repo...

compelling commented 7 years ago

I've forked the plugin into a repo called https://github.com/compelling/cordova-plugin-geofence/ that works fine for me with the fixes - and also with fixes for the android versions that used some obsolete java http methods (as the android version cannot use the javascript callbacks for geofence crossing).

ElieSauveterre commented 7 years ago

@compelling Works for me too. Is that possible to make a pull request to the main repo (cowbell/cordova-plugin-geofence) ? It's easier for future updates.

mosh2151984 commented 7 years ago

1- ionic platform remove ios 2- rm -rf plugins/ 3- in config.xml

plugin name="phonegap-plugin-push" spec="git+https://github.com/phonegap/phonegap-plugin-push.git"> 4- in package.json "dependencies":{ ..... "phonegap-plugin-push": "git+https://github.com/phonegap/phonegap-plugin-push.git", "cordova-plugin-geofence": "git+https://github.com/ypelud/cordova-plugin-geofence.git", ... } 4- ionic platform add ios 5- Goto : ./platforms/ios/cordova npm install ios-sim 6- finaly run ionic run ios --livereload --consolelogs
brijesh-p commented 6 years ago

Hello Guys, I am able to compile swift code but geofence trigger not working in IOS. I am using ionic 2 cordova geofence plugin. Please help me to get notified on IOS app.

@Corebee - seems you have same issue, pls let me know if this issue has been solved?

compelling commented 6 years ago

Plugin works fine for me, but i had to update location access description entries for plist file for iOS11: E.g.


        <config-file mode="add" parent="NSLocationAlwaysAndWhenInUseUsageDescription" target="*-Info.plist">
            <string>This app requires constant access to your location in order for auto alarm on/off to work.</string>
        </config-file>
        <config-file mode="add" parent="NSLocationWhenInUseUsageDescription" target="*-Info.plist">
            <string>This app requires access to your location in find estate address distance.</string>
        </config-file>
brijesh-p commented 6 years ago

@compelling, yes I had added 'NSLocationAlwaysAndWhenInUseUsageDescription' in info.plist.

n40jpj commented 6 years ago

@compelling great work - has anyone had this working successfully with xcode v9 or above? My basic understanding is that it would need to be compilable swift code at version 3.2 or higher?