iPhone 6 iOS 8 - Deprecated attempt to access property


#1

I’m not sure if anyone else has come across this bug but after upgrading to an iphone 6 with ios 8 app is throwing these erros in console:
Deprecated attempt to access property ‘userAgent’ on a non-Navigator object
Deprecated attempt to access property ‘geolocation’ on a non-Navigator object
Deprecated attempt to access property ‘platform’ on a non-Navigator object

the geolocation error is getting thrown on a simple getCurrentPostion call

navigator.geolocation.getCurrentPosition(setLocation, error);

This issue means that the geolocation never prompts the user to allow access making this feature unusable.

I have upgrade to the latest version of cordova and the latest version of the cordova geolocation plugin.

Has anyone come across this or have any ideas on a solution.


#2

Hey guys,

Just following up on this. Turns out when I upgraded to the latest version if xcode it meant I had to reinclude the geolocation library in my app.

DJ


#3

Thanks mate, but what if I am not using the geolocation library in my app?, I am getting the userAgent message.


#4

From what I have read that message is just a warning and shouldn’t effect the function of the app. Is the userAgent call still working for you?


#5

I’m pretty sure this was happening on our iPhone 5 devices running ios8 also. No issues were discovered in our testing


#6

Im getting this to, and Im about to explode… I cant solve this… please help!

Everything was just fine until i updated the Cordova CLI to 4.0 and xcode to 6.1.

Now everytime I add ios platform and build I get this error

** BUILD FAILED **


The following build commands failed:
	CompileC build/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Objects-normal/i386/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
	CompileC build/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Objects-normal/i386/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
	CompileC build/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Objects-normal/i386/CDVPluginResult.o Classes/CDVPluginResult.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
	CompileC build/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Objects-normal/i386/NSData+Base64.o Classes/NSData+Base64.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(4 failures)
Error: /Users/tobias/Toxic projects/gapless/platforms/ios/cordova/build: Command failed with exit code 65
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Process.ChildProcess._handle.onexit (child_process.js:820:5)

To solve this I have to remove everything in (I have no idea what I delete…) /var/folders/yh/rl8xg50x6d937pszdn43wy4w0000gp/C/com.apple.DeveloperTools/6.1-6A1052d/Xcode/SharedPrecompiledHeaders

Then, when Im able to build, when I try to run the app from xcode (emulator) I get the error @itisdj got: Deprecated attempt to access property 'userAgent' on a non-Navigator object

Here’s an issue on Apache.org, maybe it has to do with that?
https://issues.apache.org/jira/browse/CB-6911

Any ideas?


#7

So just to run through the list, there were a few things that caught me when I went to cordova cli 4 and xocde 6.

Spaces in the path name - Sounds like it wouldn’t cause any issues, but it does unfortunately.

ios-sim 3 - With xcode6, ios-sim has been updated to v3, make sure you have that installed.

Plugins - Updates to plugins are still being pushed out, so it’s always a good idea to pull from their git repo.

Any more info you could provide @tobbe?


#8

Thanks a lot for your time @mhartington !

Hmm, I acctually got a space in the folder name that the project is in. But could that really cause ‘ionic build’ to fail?

Gonna upgrade ios-sim. But I can run the app in the emulator, so hmm. Or does the CLI use it when building?

Only got the plugins ionic installs with a fresh project.

Any idea what the error I get when the app runs (“Depreched attempt to…”) could come from?
I never use eighter geolocation or user agent methods.

I rage quitted work so I’ll try this tomorrow. If it doesn’t work I’ll scream for help again :wink:


#9

Spaces - I didn’t think it could either, but it seem to be an issue with the cordova cli, which we are built on top of.

Not sure about that error, but it could be on the cordova side of things.


#10

hmmmmm… removing the space seems to have solved the error i got when building (thanks!!! and fuck xcode for that).

But Im still getting the “Deprecated attempt to access property”-error and it stops my app from working. Everything works on android and in the browser, but not ios.
I’ve tried to build with cordova platform add ios + cordova build ios but it gives me the same error…

Project on cordova ios platform 3.6.3. What version do run that works @mhartington?

edit: Im actually able to console.log something in $ionicPlatform.ready

EDIT: wtf… I don’t get the error if I use iOS 7.1, but the app still doesn’t work (in iOS emulator or on iOS device), I just see a black screen… But I get NO errors…

EDIT2: it seems like those errors doesnt actually do any harm. The real problem was this:


#11

Wooah a lot going on here…sooo is everything resolved?

Just to clarify, the spaces issue is on the cordova side of thing, specifically the cordova cli.


#12

sorry for my spamming. Yea, it has nothing to do with ionic. The real problem seems to have been in the linked thread.


#13

Hello, could you please tell me how to re include the geoLocation library?