Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by mplaczek · Sep 17, 2014 at 03:29 PM · ioslocationu3dxt

iOS 8 location services not working

I'm using an iPhone 5 / iPad 4th gen both with iOS 8 GM, Xcode 6.0 and Unity 4.6.0b17 I've been having trouble with location services on the devices... very frustrating as I previously had this working.

To rule out any other issues, I crated an empty project with a scene containing a cube. I attached the following script from unity script reference: http://docs.unity3d.com/ScriptReference/LocationService.Start.html And installed the application on my device. Additionally, I tried a second new project using U3DXT examples scene unmodified and installed it on my device also.

Firstly I'm not prompted to enable location services in either application, and in the unity script reference application, a location of 0,0,0,0 is returned.

In the device Settings > Privacy > Location Services, my applications are listed but no selection appears in the tableview. If I select 'always' in the setting screen and return to either application the location still is not determined. When I recheck the Settings > Privacy > Location Services after relaunching the application, the 'always' selection seems to have reset to having no selection.

An older build I created a while back seems to be working correctly.

Does this seem like a iOS 8 GM issue? Is it possible I've inadvertently done something silly to a setting in Unity?

Any thoughts or suggestions would be helpful.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by pavel_stupka · Sep 23, 2014 at 11:21 AM

Hi there, first of all I'm using Unity 4.5.4f1 but the solution should be the same. After you build an Xcode project from Unity, open it it Xcode and then:

  * Find -> Find in Project
  * Search for: startUpdatingLocation
  * It should find 2 source files:  "iPhone_Sensors.h" and  "iPhone_Sensors.mm" 
  * Open "iPhone_Sensors.h" and add:
 
     #define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
 
  * Open iPhone_Sensors.mm and before the line:
 
     [locationManager startUpdatingLocation];
 
     Add the following code:
 
     if(IS_OS_8_OR_LATER) {
        [locationManager requestAlwaysAuthorization];
     }
     
  * At the end add "NSLocationAlwaysUsageDescription" to your Info.plist as a string with your customized message.

See more at: http://9to5mac.com/2014/06/04/apple-improves-location-services-in-ios-8-with-when-in-use-mode-visit-monitoring/

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mplaczek · Sep 23, 2014 at 01:33 PM 0
Share

Hi, thanks for the reply. This solution works, in part, beautifully. Once I have set the Privacy > Location Services > > Always... I am able to successfully pull the location from the device. Perfect!

However, I'm not asked to "Allow to access your location..." When I try to access the location for the first time. I've deleted the application and rebuilt using Xcode as I know that can be an issue. However, the request is still never made. I currently need to go into the location services settings and specifically set the app to Always.

Any other thoughts on what may be going wrong?

Thank you very much for you time with this, it is greatly appreciated.

avatar image mplaczek · Sep 23, 2014 at 02:04 PM 0
Share

Oh, this is even more strange. I managed to get your solution to work perfectly when the application launches into my own custom scene... the request for authorisation pops up straight away. It just didn't work from when launching into the example scenes in U3DXT in the same Unity project.

Thank you for your help pavel_stupka.

avatar image petey · Sep 25, 2014 at 09:58 AM 0
Share

Hey thanks for posting this answer! I've been banging my head against the wall thinking I was doing something wrong. You RoCk!

avatar image Timberoth · Oct 18, 2014 at 09:14 PM 0
Share

Thanks for posting I was running into this exact problem on iOS8 running Unity 4.5.3. I'll give your solution a test and hopefully Unity officially fixes it soon.

avatar image fschneider · Dec 03, 2014 at 10:20 AM 0
Share

Will there be any Unity patch to fix this? I mean the Xcode project might be overwritten, and adjusting the generated code every time seems to be very tedious. Using 4.5.5 currently.

Show more comments
avatar image
0

Answer by fschneider · Dec 03, 2014 at 10:23 AM

It seems 4.5.5p1 is such a patch, see http://unity3d.com/unity/qa/patch-releases

I recommend to install at least patch 2 however as patch 1 contains a new bug.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

U3DXT: How to setup Achievement Banners 1 Answer

[U3DXT] Bug? SocialXT.PostCompleted called with completed=true even if posting was unsuccessful 1 Answer

U3DXT Game Crashes when calling SocialXT.Share 1 Answer

Input.location.isEnabledByUser returning wrong value iOS 0 Answers

U3DXT: ResetAchievements method not visible? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges