Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 115

Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
03/30/16 11:42 AM (8 years ago)

Fix for Location Menu Plugin

I implemented a fix for the Smug Location Menu Plugin, and am posting it here in case you all may need it. Plus, then next time I need it I can find it more easily. With iOS 8, more permissions are required for using the device location. The Smug Location Menu uses the device's location to calculate the distance from the all of the items in the table. However, without this additional code, the device is always as 0 latitude and 0 longitude, which is in the Gulf of Guinea (near Africa). The plugin couldn't pull device's actual latitude and longitude. With permissions changes to iOS 8, we need additional code to obtain the actual latitude and longitude. In the plist, I added the following. This is the xml--to edit the xml, just right click the plist-Open As->Source Code. <key>NSLocationWhenInUseUsageDescription</key> <string>Location data needed to calculate distances</string> And in the plugin's viewDidLoad, I added the following, right after the super viewDidLoad. maineems_appDelegate *appDelegate = (maineems_appDelegate *)[[UIApplication sharedApplication] delegate]; if ([appDelegate.rootLocationMonitor.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) [appDelegate.rootLocationMonitor.locationManager requestAlwaysAuthorization]; Thanks for a great plugin, Smug!
 
benedettoapp
Lost but trying
Profile
Posts: 139
Reg: Jun 22, 2013
Italy
6,340
like
03/30/16 11:55 AM (8 years ago)
Just a question, you fixed it for IOS, does it work fine for android?
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
03/30/16 12:05 PM (8 years ago)
This fix is in reaction to new requirements for iOS. There is no parallel change to Android.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/30/16 02:38 PM (8 years ago)
Glad you got it worked out Sue; I kinda thought that might be the problem. Thanks for posting the solution as well... Similar posts have been made, but once they drop off, it's hard to locate them without some specific googling :) @benedettoapp: Things should continue as normal for Android. But if you (or anyone) has an issue with one of my plugins (either iOS or Android), please feel free to call me out; We can always find time to fix our code if need be. Cheers! -- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.