cowbell / cordova-plugin-geofence

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

geofence plugin no longer compiles on ios #38

Closed DataHerder closed 9 years ago

DataHerder commented 9 years ago

Hi, with the recent update of the core apple system that happened last night, it appears to me this plugin is no longer compatible. I'm getting build compile errors in Swift. Would love to help out but at present have no time so I'm passing this along. Please fix as soon as possible! :)

What I did to test this:

  1. downloaded fresh ionic-geofence example app from github
  2. have correct cli when running npm install
  3. ran npm install
  4. added ios platform (all plugins carried over from the output)
  5. ran in emulate: 5 swift compile errors
  6. ran in xcode: 19 swift compile errors

These errors are found in: Plugins/json.swift Plugins/SwiftData.swift And your plugin, I replaced "as" to "as!" which fixes your issues apparently but it appears you are using libraries that are no longer compatible.

Thanks!

UXVirtual commented 9 years ago

+1 to this. We've having the same problem getting projects using this plugin to compile in XCode 6.3.

DataHerder commented 9 years ago

I actually fixed this, it looks like there were some mild changes to swift that broke this. One issue is the NSString optional assigned to a String variable, just changing NSString to String fixes it and there's some "as" to "as!" changes. I forked the repo, I'll make changes and push and see if he can help test and make sure that everything still works as expected before he merges.

Thanks!

tsubik commented 9 years ago

Great :+1: . I haven't upgraded to XCode 6.3 yet. Waiting for PR

DataHerder commented 9 years ago

Hey tsubik! I just pushed this to the forked repo, let me know when you have a chance to look it over. It has formatting changes on top of the code changes so the diffs are a little muddy.

EDIT -- The muddy diffs bothered me so I reverted back and did a copy over. Just the changes are in the diffs for ease of view

UXVirtual commented 9 years ago

Hey @DataHerder I'm getting the following errors after installing your fork of the plugin:

2015-04-17 09:26:28.044 notificationTesterApp[1520:376116] CDVPlugin class HWPGeofencePlugin (pluginName: GeofencePlugin) does not exist.
2015-04-17 09:26:28.045 notificationTesterApp[1520:376116] ERROR: Plugin 'GeofencePlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2015-04-17 09:26:28.045 notificationTesterApp[1520:376116] -[CDVCommandQueue executePending] [Line 159] FAILED pluginJSON = ["GeofencePlugin534443115","GeofencePlugin","initialize",[]]
2015-04-17 09:26:28.045 notificationTesterApp[1520:376116] CDVPlugin class HWPGeofencePlugin (pluginName: GeofencePlugin) does not exist.
2015-04-17 09:26:28.046 notificationTesterApp[1520:376116] ERROR: Plugin 'GeofencePlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.

This is after removing the generated XCode project and creating it again using cordova platform add ios and cordova build ios.

DataHerder commented 9 years ago

I was able to successfully compile the application using my repo with a new starter project. Here are the steps:

Step 1: ionic start test-geo

Step 2: sudo chmod 777 test-geo I need to do that on my machine or I get a node error, may not be the same for you

Step 3: sudo npm install

Step 4: cordova plugin add https://github.com/DataHerder/cordova-plugin-geofence.git

Step 5: ionic platform add ios

Step 6: Open up xcode project in Xcode and compile

UXVirtual commented 9 years ago

What kind of build settings are you using in Xcode? I'm getting the following errors now: when targeting iOS 7.0 or higher as my deployment target: screenshot

I've created a fresh project and followed the above steps.

UXVirtual commented 9 years ago

Turns out that creating a new ionic project over the top of the existing project isn't a good idea. It's running as expected now without compile errors. :-P

DataHerder commented 9 years ago

:+1: cool!

rlataguerra commented 9 years ago

@DataHerder I can confirm that too (the String an as!) I made the change on my project and it worked great.

Are you doing a pull request? If not, I will

DataHerder commented 9 years ago

I am unable to create a branch on this project and I am unable to push to a branch on this project at this time unless tsubik gives me access apparently. I get Forbidden access pushing a branch "swift-change" to the repo.

rlataguerra commented 9 years ago

https://github.com/cowbell/cordova-plugin-geofence/pull/39