cowbell / ionic-geofence

Ionic geofence app example
MIT License
180 stars 92 forks source link

Cannot add geofence on iOS device #5

Closed harryfk closed 8 years ago

harryfk commented 9 years ago

Just downloaded your sample app, seems to work fine in the browser, however geofences are hard to test in a bowser, so I wanted to test on a real device. :)

I installed it on my iPhone 5S (iOS8) with ionic run ios … app starts up fine, all UI looks good. I hit the + button, $ionicLoading comes up trying to fetch the location and then it just goes away. No error message, just fades away and shows the start screen again. I expected the little native popup to come up whether I want to allow the app to access my location, but get nothing of the likes. Just fails silently.

Any idea how to debug this or what is going wrong?

Thanks a bunch for your work!

bob1th commented 9 years ago

I think for ios testing, you need to add the geofence plugin. However, when I do, I get compile errors with Swift using SDKROOT = iphonesimulator8.3. I am not familiar with Swift at all, so can't really tell what's wrong.

Sample error message:

.../.../ionic-geofence/platforms/ios/ionic-geofence/Plugins/com.cowbell.cordova.geofence/SwiftData.swift:1018:149: error: 'AnyObject' is not convertible to 'String'; did you mean to use 'as!' to force downcast? let docsPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0] as String

bob1th commented 9 years ago

In my case, the compile error was due to the fact that I have the latest Xcode 6.3 beta 2 with Swift 1.2. I had to convert swift codes to Swift1.2 and everything worked.

bx5974 commented 9 years ago

bob1th, can you pls explain how you fixed this issue ?

when i do

$ ionic build ios

\ BUILD FAILED **

The following build commands failed: CompileSwift normal i386 /Users/bx/ionic/geoFenTry/platforms/ios/geoFenTry/Plugins/com.cowbell.cordova.geofence/GeofencePlugin.swift CompileSwift normal i386 /Users/bx/ionic/geoFenTry/platforms/ios/geoFenTry/Plugins/com.cowbell.cordova.geofence/SwiftData.swift CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler (3 failures) Error code 65 for command: xcodebuild with args: -xcconfig,/Users/bx/ionic/geoFenTry/platforms/ios/cordova/build-debug.xcconfig,-project,geoFenTry.xcodeproj,ARCHS=i386,-target,geoFenTry,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/bx/ionic/geoFenTry/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/bx/ionic/geoFenTry/platforms/ios/build/sharedpch ERROR building one of the platforms: Error: /Users/bx/ionic/geoFenTry/platforms/ios/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /Users/bx/ionic/geoFenTry/platforms/ios/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1015:16) at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

tsubik commented 8 years ago

I believe that should be fixed by now.