Ir para conteúdo
Visualizar no app

Uma forma melhor de navegar. Saiba mais.

MM Fórum

Um app em tela cheia na sua Tela de Início com notificações push, avisos e mais.

Para instalar este app no iOS/iPadOS
  1. Toque no ícone de Compartilhamento no Safari
  2. Role o menu e toque em Adicionar à Tela de Início.
  3. Toque em Adicionar no canto superior direito.
Para instalar este app no Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problema com Location services em uma App

Featured Replies

Postado

Boa noite a todos!

Estou desenvolvendo uma App para iPhone que faz uso do serviço de localização (Location Services).

Mesmo com o Location Services habilitado, quando tento obter a localização atual do usuário, nada acontece, nenhum erro. O estranho também é que aquele "prompt" perguntando se o usuário permite a App utilizar o serviços de localização nunca é mostrado.

Vou deixar um trecho do código, que é o que está na documentação da Apple. Como podem observar o código, na verificação se o serviço está habilitado, retorna true, mas mesmo assim nada acontece.


- (void)getCurrentLocation{
if ([CLLocationManager locationServicesEnabled]) {
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = 500;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation{
// codigo omitido para obter a latitude e longitude
}
[/CODE]

Alguém já passou por algo parecido?

*Obs: O teste está sendo feito diretamento no dispositivo, sem uso do simulador.

Abs.

  • Respostas 8
  • Visualizações 1.9k
  • Criado
  • Última resposta

Top Postadores Neste Tópico

Postado

vc setou o <CLLocationManagerDelegate> no header?

Postado
  • Autor

Sim, com certeza.

Postado

Boas,

Bom a primeira pergunta que faria você já respondeu ao Ferbass.

Seu código abaixo:

- (void)getCurrentLocation{

if ([CLLocationManager locationServicesEnabled]) {

locationManager = [[CLLocationManager alloc] init];

locationManager.delegate = self;

locationManager.desiredAccuracy = kCLLocationAccuracyBest;

locationManager.distanceFilter = 500;

[locationManager startUpdatingLocation];

}

- (void)locationManagerCLLocationManager *)manager

didUpdateToLocationCLLocation *)newLocation

fromLocationCLLocation *)oldLocation{

// codigo omitido para obter a latitude e longitude

}

Se tiver com todas as libs do xcode vá em: projeto depois busque na coluna info :

url types

clique sobre busque: localization native development..... e veja qual é o valor ao lado se yes ou no.

Em tempo busque essa lib e outra que falta neste link : https://github.com/libgit2/libgit2

[]´s

Editado por urielm

Postado

Boa noite a todos!

Estou desenvolvendo uma App para iPhone que faz uso do serviço de localização (Location Services).

Mesmo com o Location Services habilitado, quando tento obter a localização atual do usuário, nada acontece, nenhum erro. O estranho também é que aquele "prompt" perguntando se o usuário permite a App utilizar o serviços de localização nunca é mostrado.

Vou deixar um trecho do código, que é o que está na documentação da Apple. Como podem observar o código, na verificação se o serviço está habilitado, retorna true, mas mesmo assim nada acontece.


- (void)getCurrentLocation{
if ([CLLocationManager locationServicesEnabled]) {
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = 500;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation{
// codigo omitido para obter a latitude e longitude
}
[/CODE]

Alguém já passou por algo parecido?

*Obs: O teste está sendo feito diretamento no dispositivo, sem uso do simulador.

Abs.

[b]Veja se ajuda em algo:[/b]

________________________________________________________________________

[b][size=3]Enabled locationManager:didChangeAuthorizationStatus: in app delegate[/size][/b]

<?xml version="1.0" encoding="UTF-8"?>

<Workspace

version = "1.0">

<FileRef

location = "self:LocationServices.xcodeproj">

</FileRef>

</Workspace>

________________________________________________________________________

[b]LocationServicesViewController.m[/b]

[color=#999999][b]//[/b][/color]

[color=#999999][b]// LocationServicesViewController.m[/b][/color]

[color=#999999][b]// LocationServices[/b][/color]

[color=#999999][b]//[/b][/color]

[color=#999999][b]// Created by Michael Harper on 9/1/11.[/b][/color]

[color=#999999][b]// Copyright 2011 Standalone Code LLC. All rights reserved.[/b][/color]

[color=#999999][b]//[/b][/color]

[color=#999999][b]#import "LocationServicesViewController.h"[/b][/color]

[b]@implementation[/b] [color=#445588][b]LocationServicesViewController[/b][/color]

[b]@synthesize[/b] latitudeLabel;

[b]@synthesize[/b] longitudeLabel;

[b]@synthesize[/b] headingLabel;

[b]@synthesize[/b] altitudeLabel;

[b]@synthesize[/b] hAccLabel;

[b]@synthesize[/b] vAccLabel;

[b]@synthesize[/b] lsLabel;

[b]@synthesize[/b] currentLocation;

[b]@synthesize[/b] currentHeading;

[b]@synthesize[/b] degreesFormatter;

[b]@synthesize[/b] distanceFormatter;

[b]@synthesize[/b] pitchLabel;

[b]@synthesize[/b] rollLabel;

[b]@synthesize[/b] yawLabel;

[color=#999999][b]#pragma mark - View lifecycle[/b][/color]

[b]-[/b] ([color=#445588][b]void[/b][/color])[color=#990000][b]viewDidLoad[/b][/color]

{

[super viewDidLoad];

[self addObserver:self forKeyPath:[color=#DD1144]@"currentLocation"[/color] options:NSKeyValueObservingOptionNew context:[color=#0086B3]nil[/color]];

[self addObserver:self forKeyPath:[color=#DD1144]@"currentHeading"[/color] options:NSKeyValueObservingOptionNew context:[color=#0086B3]nil[/color]];

self.degreesFormatter [b]=[/b] [[NSNumberFormatter alloc] init];

degreesFormatter.minimumIntegerDigits [b]=[/b] [color=#009999]1[/color];

degreesFormatter.maximumFractionDigits [b]=[/b] [color=#009999]6[/color];

self.distanceFormatter [b]=[/b] [[NSNumberFormatter alloc] init];

distanceFormatter.minimumIntegerDigits [b]=[/b] [color=#009999]1[/color];

distanceFormatter.maximumFractionDigits [b]=[/b] [color=#009999]1[/color];

}

[b]-[/b] ([color=#445588][b]void[/b][/color])[color=#990000][b]viewDidUnload[/b][/color]

{

[self removeObserver:self forKeyPath:[color=#DD1144]@"currentLocation"[/color]];

[self removeObserver:self forKeyPath:[color=#DD1144]@"currentHeading"[/color]];

[self setLatitudeLabel:[color=#0086B3]nil[/color]];

[self setLongitudeLabel:[color=#0086B3]nil[/color]];

[self setHeadingLabel:[color=#0086B3]nil[/color]];

[self setAltitudeLabel:[color=#0086B3]nil[/color]];

[self setHAccLabel:[color=#0086B3]nil[/color]];

[self setVAccLabel:[color=#0086B3]nil[/color]];

[self setLsLabel:[color=#0086B3]nil[/color]];

[self setPitchLabel:[color=#0086B3]nil[/color]];

[self setRollLabel:[color=#0086B3]nil[/color]];

[self setYawLabel:[color=#0086B3]nil[/color]];

[self setDegreesFormatter:[color=#0086B3]nil[/color]];

[self setDistanceFormatter:[color=#0086B3]nil[/color]];

[super viewDidUnload];

}

[b]-[/b] ([color=#445588][b]BOOL[/b][/color])[color=#990000][b]shouldAutorotateToInterfaceOrientation:[/b][/color](UIInterfaceOrientation)[color=#008080]interfaceOrientation[/color]

{

[b]return[/b] (interfaceOrientation [b]==[/b] UIInterfaceOrientationPortrait);

}

[color=#999999][b]#pragma mark CLLocationManagerDelegate methods[/b][/color]

[b]-[/b] ([color=#445588][b]void[/b][/color])[color=#990000][b]locationManager:[/b][/color](CLLocationManager [b]*[/b])[color=#008080]manager[/color] [color=#990000][b]didChangeAuthorizationStatus:[/b][/color](CLAuthorizationStatus)[color=#008080]status[/color]

{

NSString [b]*[/b]lsStatus [b]=[/b] [color=#DD1144]@""[/color];

[b]switch[/b] (status)

{

[b]case[/b] kCLAuthorizationStatusNotDetermined:

lsStatus [b]=[/b] [color=#DD1144]@"Undetermined"[/color];

[b]break[/b];

[b]case[/b] kCLAuthorizationStatusRestricted:

lsStatus [b]=[/b] [color=#DD1144]@"Restricted"[/color];

[b]break[/b];

[b]case[/b] kCLAuthorizationStatusDenied:

lsStatus [b]=[/b] [color=#DD1144]@"Denied"[/color];

[b]break[/b];

[b]case[/b] kCLAuthorizationStatusAuthorized:

lsStatus [b]=[/b] [color=#DD1144]@"Authorized"[/color];

[b]break[/b];

[b]default[/b][b]:[/b]

[b]break[/b];

}

lsLabel.text [b]=[/b] lsStatus;

}

[b]-[/b]([color=#445588][b]void[/b][/color]) [color=#990000][b]locationManager:[/b][/color](CLLocationManager [b]*[/b])[color=#008080]manager[/color] [color=#990000][b]didUpdateToLocation:[/b][/color](CLLocation [b]*[/b])[color=#008080]newLocation[/color] [color=#990000][b]fromLocation:[/b][/color](CLLocation [b]*[/b])[color=#008080]oldLocation[/color]

{

[b]if[/b] (newLocation.horizontalAccuracy [b]>[/b] [color=#009999]0[/color])

{

self.currentLocation [b]=[/b] newLocation;

}

}

[b]-[/b] ([color=#445588][b]void[/b][/color])[color=#990000][b]locationManager:[/b][/color](CLLocationManager [b]*[/b])[color=#008080]manager[/color] [color=#990000][b]didUpdateHeading:[/b][/color](CLHeading [b]*[/b])[color=#008080]newHeading[/color]

{

[b]if[/b] (newHeading.headingAccuracy [b]>[/b] [color=#009999]0[/color])

{

self.currentHeading [b]=[/b] newHeading;

}

}

[b]-[/b]([color=#445588][b]void[/b][/color]) [color=#990000][b]updateMotionInfo:[/b][/color](CMDeviceMotion [b]*[/b]) motionInfo

{

NSNumber [b]*[/b]number [b]=[/b] [NSNumber alloc];

pitchLabel.text [b]=[/b] [degreesFormatter stringFromNumber:[number initWithDouble:radiansToDegrees(motionInfo.attitude.pitch)]];

rollLabel.text [b]=[/b] [degreesFormatter stringFromNumber:[number initWithDouble:radiansToDegrees(motionInfo.attitude.roll)]];

yawLabel.text [b]=[/b] [degreesFormatter stringFromNumber:[number initWithDouble:radiansToDegrees(motionInfo.attitude.yaw)]];

}

[color=#999999][b]#pragma mark KVO[/b][/color]

[b]-[/b] ([color=#445588][b]void[/b][/color])observeValueForKeyPath:(NSString [b]*[/b])keyPath ofObject:([color=#445588][b]id[/b][/color])object change:(NSDictionary [b]*[/b])change context:([color=#445588][b]void[/b][/color] [b]*[/b])context

{

NSNumber [b]*[/b]number [b]=[/b] [NSNumber alloc];

[b]if[/b] ([keyPath isEqualToString:[color=#DD1144]@"currentLocation"[/color]])

{

CLLocation [b]*[/b]newLocation [b]=[/b] [change objectForKey:NSKeyValueChangeNewKey];

latitudeLabel.text [b]=[/b] [degreesFormatter stringFromNumber:[number initWithFloat:newLocation.coordinate.latitude]];

longitudeLabel.text [b]=[/b] [degreesFormatter stringFromNumber:[number initWithFloat:newLocation.coordinate.longitude]];

altitudeLabel.text [b]=[/b] [distanceFormatter stringFromNumber:[number initWithFloat:newLocation.altitude]];

hAccLabel.text [b]=[/b] [distanceFormatter stringFromNumber:[number initWithFloat:newLocation.horizontalAccuracy]];

vAccLabel.text [b]=[/b] [distanceFormatter stringFromNumber:[number initWithFloat:newLocation.verticalAccuracy]];

}

[b]else[/b] [b]if[/b] ([keyPath isEqualToString:[color=#DD1144]@"currentHeading"[/color]])

{

CLHeading [b]*[/b]newHeading [b]=[/b] [change objectForKey:NSKeyValueChangeNewKey];

headingLabel.text [b]=[/b] [degreesFormatter stringFromNumber:[number initWithFloat:newHeading.magneticHeading]];

}

}

[b]@end[/b]

________________________________________________________________________

[size=4]_________________________________________________________[/size]

[b]project.pbxproj[/b]

// !$*UTF8*$!

{

archiveVersion = 1;

classes = {

};

objectVersion = 46;

objects = {

/* Begin PBXBuildFile section */

B5E105CA141862000088AB8C /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = B5E105C9141862000088AB8C /* Icon@2x.png */; };

B5E105CC141862450088AB8C /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B5E105CB141862450088AB8C /* Icon.png */; };

D87348FA141FF03C0060F374 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D87348F9141FF03C0060F374 /* CoreMotion.framework */; };

D8E1032D1410263600A403DB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E1032C1410263600A403DB /* UIKit.framework */; };

D8E1032F1410263600A403DB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E1032E1410263600A403DB /* Foundation.framework */; };

D8E103311410263600A403DB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E103301410263600A403DB /* CoreGraphics.framework */; };

D8E103371410263600A403DB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D8E103351410263600A403DB /* InfoPlist.strings */; };

D8E103391410263600A403DB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D8E103381410263600A403DB /* main.m */; };

D8E1033D1410263600A403DB /* LocationServicesAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D8E1033C1410263600A403DB /* LocationServicesAppDelegate.m */; };

D8E103401410263600A403DB /* LocationServicesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D8E1033F1410263600A403DB /* LocationServicesViewController.m */; };

D8E103431410263600A403DB /* LocationServicesViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = D8E103411410263600A403DB /* LocationServicesViewController_iPhone.xib */; };

D8E1034E1410263600A403DB /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E1034D1410263600A403DB /* SenTestingKit.framework */; };

D8E1034F1410263600A403DB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E1032C1410263600A403DB /* UIKit.framework */; };

D8E103501410263600A403DB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E1032E1410263600A403DB /* Foundation.framework */; };

D8E103511410263600A403DB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E103301410263600A403DB /* CoreGraphics.framework */; };

D8E103591410263600A403DB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D8E103571410263600A403DB /* InfoPlist.strings */; };

D8E1035C1410263600A403DB /* LocationServicesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D8E1035B1410263600A403DB /* LocationServicesTests.m */; };

D8E10366141026E900A403DB /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8E10365141026E900A403DB /* CoreLocation.framework */; };

/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */

D8E103521410263600A403DB /* PBXContainerItemProxy */ = {

isa = PBXContainerItemProxy;

containerPortal = D8E1031F1410263500A403DB /* Project object */;

proxyType = 1;

remoteGlobalIDString = D8E103271410263600A403DB;

remoteInfo = LocationServices;

};

/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */

B5E105C9141862000088AB8C /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };

B5E105CB141862450088AB8C /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };

B5E105CD141865350088AB8C /* AppIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = AppIcon.png; sourceTree = "<group>"; };

D87348F9141FF03C0060F374 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };

D8E103281410263600A403DB /* Locinator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Locinator.app; sourceTree = BUILT_PRODUCTS_DIR; };

D8E1032C1410263600A403DB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };

D8E1032E1410263600A403DB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };

D8E103301410263600A403DB /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };

D8E103341410263600A403DB /* LocationServices-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LocationServices-Info.plist"; sourceTree = "<group>"; };

D8E103361410263600A403DB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };

D8E103381410263600A403DB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };

D8E1033A1410263600A403DB /* LocationServices-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "LocationServices-Prefix.pch"; sourceTree = "<group>"; };

D8E1033B1410263600A403DB /* LocationServicesAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocationServicesAppDelegate.h; sourceTree = "<group>"; };

D8E1033C1410263600A403DB /* LocationServicesAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocationServicesAppDelegate.m; sourceTree = "<group>"; };

D8E1033E1410263600A403DB /* LocationServicesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocationServicesViewController.h; sourceTree = "<group>"; };

D8E1033F1410263600A403DB /* LocationServicesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocationServicesViewController.m; sourceTree = "<group>"; };

D8E103421410263600A403DB /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/LocationServicesViewController_iPhone.xib; sourceTree = "<group>"; };

D8E1034C1410263600A403DB /* LocationServicesTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LocationServicesTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };

D8E1034D1410263600A403DB /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };

D8E103561410263600A403DB /* LocationServicesTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "LocationServicesTests-Info.plist"; sourceTree = "<group>"; };

D8E103581410263600A403DB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };

D8E1035A1410263600A403DB /* LocationServicesTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocationServicesTests.h; sourceTree = "<group>"; };

D8E1035B1410263600A403DB /* LocationServicesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocationServicesTests.m; sourceTree = "<group>"; };

D8E10365141026E900A403DB /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };

/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */

D8E103251410263600A403DB /* Frameworks */ = {

isa = PBXFrameworksBuildPhase;

buildActionMask = 2147483647;

files = (

D87348FA141FF03C0060F374 /* CoreMotion.framework in Frameworks */,

D8E10366141026E900A403DB /* CoreLocation.framework in Frameworks */,

D8E1032D1410263600A403DB /* UIKit.framework in Frameworks */,

D8E1032F1410263600A403DB /* Foundation.framework in Frameworks */,

D8E103311410263600A403DB /* CoreGraphics.framework in Frameworks */,

);

runOnlyForDeploymentPostprocessing = 0;

};

D8E103481410263600A403DB /* Frameworks */ = {

isa = PBXFrameworksBuildPhase;

buildActionMask = 2147483647;

files = (

D8E1034E1410263600A403DB /* SenTestingKit.framework in Frameworks */,

D8E1034F1410263600A403DB /* UIKit.framework in Frameworks */,

D8E103501410263600A403DB /* Foundation.framework in Frameworks */,

D8E103511410263600A403DB /* CoreGraphics.framework in Frameworks */,

);

runOnlyForDeploymentPostprocessing = 0;

};

/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */

B5E105CF141866270088AB8C /* Resources */ = {

isa = PBXGroup;

children = (

B5E105CD141865350088AB8C /* AppIcon.png */,

B5E105CB141862450088AB8C /* Icon.png */,

B5E105C9141862000088AB8C /* Icon@2x.png */,

);

name = Resources;

sourceTree = "<group>";

};

D8E1031D1410263500A403DB = {

isa = PBXGroup;

children = (

D87348F9141FF03C0060F374 /* CoreMotion.framework */,

B5E105CF141866270088AB8C /* Resources */,

D8E103321410263600A403DB /* LocationServices */,

D8E103541410263600A403DB /* LocationServicesTests */,

D8E1032B1410263600A403DB /* Frameworks */,

D8E103291410263600A403DB /* Products */,

);

sourceTree = "<group>";

};

D8E103291410263600A403DB /* Products */ = {

isa = PBXGroup;

children = (

D8E103281410263600A403DB /* Locinator.app */,

D8E1034C1410263600A403DB /* LocationServicesTests.octest */,

);

name = Products;

sourceTree = "<group>";

};

D8E1032B1410263600A403DB /* Frameworks */ = {

isa = PBXGroup;

children = (

D8E10365141026E900A403DB /* CoreLocation.framework */,

D8E1032C1410263600A403DB /* UIKit.framework */,

D8E1032E1410263600A403DB /* Foundation.framework */,

D8E103301410263600A403DB /* CoreGraphics.framework */,

D8E1034D1410263600A403DB /* SenTestingKit.framework */,

);

name = Frameworks;

sourceTree = "<group>";

};

D8E103321410263600A403DB /* LocationServices */ = {

isa = PBXGroup;

children = (

D8E1033B1410263600A403DB /* LocationServicesAppDelegate.h */,

D8E1033C1410263600A403DB /* LocationServicesAppDelegate.m */,

D8E1033E1410263600A403DB /* LocationServicesViewController.h */,

D8E1033F1410263600A403DB /* LocationServicesViewController.m */,

D8E103411410263600A403DB /* LocationServicesViewController_iPhone.xib */,

D8E103331410263600A403DB /* Supporting Files */,

);

path = LocationServices;

sourceTree = "<group>";

};

D8E103331410263600A403DB /* Supporting Files */ = {

isa = PBXGroup;

children = (

D8E103341410263600A403DB /* LocationServices-Info.plist */,

D8E103351410263600A403DB /* InfoPlist.strings */,

D8E103381410263600A403DB /* main.m */,

D8E1033A1410263600A403DB /* LocationServices-Prefix.pch */,

);

name = "Supporting Files";

sourceTree = "<group>";

};

D8E103541410263600A403DB /* LocationServicesTests */ = {

isa = PBXGroup;

children = (

D8E1035A1410263600A403DB /* LocationServicesTests.h */,

D8E1035B1410263600A403DB /* LocationServicesTests.m */,

D8E103551410263600A403DB /* Supporting Files */,

);

path = LocationServicesTests;

sourceTree = "<group>";

};

D8E103551410263600A403DB /* Supporting Files */ = {

isa = PBXGroup;

children = (

D8E103561410263600A403DB /* LocationServicesTests-Info.plist */,

D8E103571410263600A403DB /* InfoPlist.strings */,

);

name = "Supporting Files";

sourceTree = "<group>";

};

/* End PBXGroup section */

/* Begin PBXNativeTarget section */

D8E103271410263600A403DB /* Locinator */ = {

isa = PBXNativeTarget;

buildConfigurationList = D8E1035F1410263600A403DB /* Build configuration list for PBXNativeTarget "Locinator" */;

buildPhases = (

D8E103241410263600A403DB /* Sources */,

D8E103251410263600A403DB /* Frameworks */,

D8E103261410263600A403DB /* Resources */,

);

buildRules = (

);

dependencies = (

);

name = Locinator;

productName = LocationServices;

productReference = D8E103281410263600A403DB /* Locinator.app */;

productType = "com.apple.product-type.application";

};

D8E1034B1410263600A403DB /* LocationServicesTests */ = {

isa = PBXNativeTarget;

buildConfigurationList = D8E103621410263600A403DB /* Build configuration list for PBXNativeTarget "LocationServicesTests" */;

buildPhases = (

D8E103471410263600A403DB /* Sources */,

D8E103481410263600A403DB /* Frameworks */,

D8E103491410263600A403DB /* Resources */,

D8E1034A1410263600A403DB /* ShellScript */,

);

buildRules = (

);

dependencies = (

D8E103531410263600A403DB /* PBXTargetDependency */,

);

name = LocationServicesTests;

productName = LocationServicesTests;

productReference = D8E1034C1410263600A403DB /* LocationServicesTests.octest */;

productType = "com.apple.product-type.bundle";

};

/* End PBXNativeTarget section */

/* Begin PBXProject section */

D8E1031F1410263500A403DB /* Project object */ = {

isa = PBXProject;

attributes = {

LastUpgradeCheck = 0420;

ORGANIZATIONNAME = "Standalone Code LLC";

};

buildConfigurationList = D8E103221410263500A403DB /* Build configuration list for PBXProject "LocationServices" */;

compatibilityVersion = "Xcode 3.2";

developmentRegion = English;

hasScannedForEncodings = 0;

knownRegions = (

en,

);

mainGroup = D8E1031D1410263500A403DB;

productRefGroup = D8E103291410263600A403DB /* Products */;

projectDirPath = "";

projectRoot = "";

targets = (

D8E103271410263600A403DB /* Locinator */,

D8E1034B1410263600A403DB /* LocationServicesTests */,

);

};

/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */

D8E103261410263600A403DB /* Resources */ = {

isa = PBXResourcesBuildPhase;

buildActionMask = 2147483647;

files = (

D8E103371410263600A403DB /* InfoPlist.strings in Resources */,

D8E103431410263600A403DB /* LocationServicesViewController_iPhone.xib in Resources */,

B5E105CA141862000088AB8C /* Icon@2x.png in Resources */,

B5E105CC141862450088AB8C /* Icon.png in Resources */,

);

runOnlyForDeploymentPostprocessing = 0;

};

D8E103491410263600A403DB /* Resources */ = {

isa = PBXResourcesBuildPhase;

buildActionMask = 2147483647;

files = (

D8E103591410263600A403DB /* InfoPlist.strings in Resources */,

);

runOnlyForDeploymentPostprocessing = 0;

};

/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */

D8E1034A1410263600A403DB /* ShellScript */ = {

isa = PBXShellScriptBuildPhase;

buildActionMask = 2147483647;

files = (

);

inputPaths = (

);

outputPaths = (

);

runOnlyForDeploymentPostprocessing = 0;

shellPath = /bin/sh;

shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";

};

/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */

D8E103241410263600A403DB /* Sources */ = {

isa = PBXSourcesBuildPhase;

buildActionMask = 2147483647;

files = (

D8E103391410263600A403DB /* main.m in Sources */,

D8E1033D1410263600A403DB /* LocationServicesAppDelegate.m in Sources */,

D8E103401410263600A403DB /* LocationServicesViewController.m in Sources */,

);

runOnlyForDeploymentPostprocessing = 0;

};

D8E103471410263600A403DB /* Sources */ = {

isa = PBXSourcesBuildPhase;

buildActionMask = 2147483647;

files = (

D8E1035C1410263600A403DB /* LocationServicesTests.m in Sources */,

);

runOnlyForDeploymentPostprocessing = 0;

};

/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */

D8E103531410263600A403DB /* PBXTargetDependency */ = {

isa = PBXTargetDependency;

target = D8E103271410263600A403DB /* Locinator */;

targetProxy = D8E103521410263600A403DB /* PBXContainerItemProxy */;

};

/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */

D8E103351410263600A403DB /* InfoPlist.strings */ = {

isa = PBXVariantGroup;

children = (

D8E103361410263600A403DB /* en */,

);

name = InfoPlist.strings;

sourceTree = "<group>";

};

D8E103411410263600A403DB /* LocationServicesViewController_iPhone.xib */ = {

isa = PBXVariantGroup;

children = (

D8E103421410263600A403DB /* en */,

);

name = LocationServicesViewController_iPhone.xib;

sourceTree = "<group>";

};

D8E103571410263600A403DB /* InfoPlist.strings */ = {

isa = PBXVariantGroup;

children = (

D8E103581410263600A403DB /* en */,

);

name = InfoPlist.strings;

sourceTree = "<group>";

};

/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */

D8E1035D1410263600A403DB /* Debug */ = {

isa = XCBuildConfiguration;

buildSettings = {

ALWAYS_SEARCH_USER_PATHS = NO;

ARCHS = "$(ARCHS_STANDARD_32_BIT)";

CLANG_ENABLE_OBJC_ARC = YES;

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

COPY_PHASE_STRIP = NO;

GCC_C_LANGUAGE_STANDARD = gnu99;

GCC_DYNAMIC_NO_PIC = NO;

GCC_OPTIMIZATION_LEVEL = 0;

GCC_PREPROCESSOR_DEFINITIONS = (

"DEBUG=1",

"$(inherited)",

);

GCC_SYMBOLS_PRIVATE_EXTERN = NO;

GCC_VERSION = com.apple.compilers.llvm.clang.1_0;

GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;

GCC_WARN_ABOUT_RETURN_TYPE = YES;

GCC_WARN_UNUSED_VARIABLE = YES;

IPHONEOS_DEPLOYMENT_TARGET = 5.0;

SDKROOT = iphoneos;

TARGETED_DEVICE_FAMILY = 1;

};

name = Debug;

};

D8E1035E1410263600A403DB /* Release */ = {

isa = XCBuildConfiguration;

buildSettings = {

ALWAYS_SEARCH_USER_PATHS = NO;

ARCHS = "$(ARCHS_STANDARD_32_BIT)";

CLANG_ENABLE_OBJC_ARC = YES;

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

COPY_PHASE_STRIP = YES;

GCC_C_LANGUAGE_STANDARD = gnu99;

GCC_VERSION = com.apple.compilers.llvm.clang.1_0;

GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;

GCC_WARN_ABOUT_RETURN_TYPE = YES;

GCC_WARN_UNUSED_VARIABLE = YES;

IPHONEOS_DEPLOYMENT_TARGET = 5.0;

OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";

SDKROOT = iphoneos;

TARGETED_DEVICE_FAMILY = 1;

VALIDATE_PRODUCT = YES;

};

name = Release;

};

D8E103601410263600A403DB /* Debug */ = {

isa = XCBuildConfiguration;

buildSettings = {

GCC_PRECOMPILE_PREFIX_HEADER = YES;

GCC_PREFIX_HEADER = "LocationServices/LocationServices-Prefix.pch";

INFOPLIST_FILE = "LocationServices/LocationServices-Info.plist";

IPHONEOS_DEPLOYMENT_TARGET = 4.2;

PRODUCT_NAME = "$(TARGET_NAME)";

WRAPPER_EXTENSION = app;

};

name = Debug;

};

D8E103611410263600A403DB /* Release */ = {

isa = XCBuildConfiguration;

buildSettings = {

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

GCC_PRECOMPILE_PREFIX_HEADER = YES;

GCC_PREFIX_HEADER = "LocationServices/LocationServices-Prefix.pch";

INFOPLIST_FILE = "LocationServices/LocationServices-Info.plist";

IPHONEOS_DEPLOYMENT_TARGET = 4.2;

PRODUCT_NAME = "$(TARGET_NAME)";

"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";

WRAPPER_EXTENSION = app;

};

name = Release;

};

D8E103631410263600A403DB /* Debug */ = {

isa = XCBuildConfiguration;

buildSettings = {

BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LocationServices.app/LocationServices";

FRAMEWORK_SEARCH_PATHS = (

"$(SDKROOT)/Developer/Library/Frameworks",

"$(DEVELOPER_LIBRARY_DIR)/Frameworks",

);

GCC_PRECOMPILE_PREFIX_HEADER = YES;

GCC_PREFIX_HEADER = "LocationServices/LocationServices-Prefix.pch";

INFOPLIST_FILE = "LocationServicesTests/LocationServicesTests-Info.plist";

PRODUCT_NAME = "$(TARGET_NAME)";

TEST_HOST = "$(BUNDLE_LOADER)";

WRAPPER_EXTENSION = octest;

};

name = Debug;

};

D8E103641410263600A403DB /* Release */ = {

isa = XCBuildConfiguration;

buildSettings = {

BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/LocationServices.app/LocationServices";

FRAMEWORK_SEARCH_PATHS = (

"$(SDKROOT)/Developer/Library/Frameworks",

"$(DEVELOPER_LIBRARY_DIR)/Frameworks",

);

GCC_PRECOMPILE_PREFIX_HEADER = YES;

GCC_PREFIX_HEADER = "LocationServices/LocationServices-Prefix.pch";

INFOPLIST_FILE = "LocationServicesTests/LocationServicesTests-Info.plist";

PRODUCT_NAME = "$(TARGET_NAME)";

TEST_HOST = "$(BUNDLE_LOADER)";

WRAPPER_EXTENSION = octest;

};

name = Release;

};

/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */

D8E103221410263500A403DB /* Build configuration list for PBXProject "LocationServices" */ = {

isa = XCConfigurationList;

buildConfigurations = (

D8E1035D1410263600A403DB /* Debug */,

D8E1035E1410263600A403DB /* Release */,

);

defaultConfigurationIsVisible = 0;

defaultConfigurationName = Release;

};

D8E1035F1410263600A403DB /* Build configuration list for PBXNativeTarget "Locinator" */ = {

isa = XCConfigurationList;

buildConfigurations = (

D8E103601410263600A403DB /* Debug */,

D8E103611410263600A403DB /* Release */,

);

defaultConfigurationIsVisible = 0;

defaultConfigurationName = Release;

};

D8E103621410263600A403DB /* Build configuration list for PBXNativeTarget "LocationServicesTests" */ = {

isa = XCConfigurationList;

buildConfigurations = (

D8E103631410263600A403DB /* Debug */,

D8E103641410263600A403DB /* Release */,

);

defaultConfigurationIsVisible = 0;

defaultConfigurationName = Release;

};

/* End XCConfigurationList section */

};

rootObject = D8E1031F1410263500A403DB /* Project object */;

}

Screenshot.pngScreenshot.png

Editado por urielm

Postado
  • Autor

Boas,

Bom a primeira pergunta que faria você já respondeu ao Ferbass.

Seu código abaixo:

- (void)getCurrentLocation{

if ([CLLocationManager locationServicesEnabled]) {

locationManager = [[CLLocationManager alloc] init];

locationManager.delegate = self;

locationManager.desiredAccuracy = kCLLocationAccuracyBest;

locationManager.distanceFilter = 500;

[locationManager startUpdatingLocation];

}

- (void)locationManagerCLLocationManager *)manager

didUpdateToLocationCLLocation *)newLocation

fromLocationCLLocation *)oldLocation{

// codigo omitido para obter a latitude e longitude

}

Se tiver com todas as libs do xcode vá em: projeto depois busque na coluna info :

url types

clique sobre busque: localization native development..... e veja qual é o valor ao lado se yes ou no.

Em tempo busque essa lib e outra que falta neste link : https://github.com/libgit2/libgit2

[]´s

Não tenho essa propriedade configurada. Qual o valor correto, yes ou no?

Obrigado.

Postado
  • Autor

Adicionei a propriedade "Localization native development region" com os valor "yes" e depois com "no". Continua na mesma.

Postado

Você afirma não ter nenhum erro porque nada acontece ou porque você verificou no console ou pelo debug?

O método abaixo está implementado para que você possa ver se está entrando nele?

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
}[/CODE]

Postado
  • Autor

Você afirma não ter nenhum erro porque nada acontece ou porque você verificou no console ou pelo debug?

O método abaixo está implementado para que você possa ver se está entrando nele?

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {
}[/CODE]

Está implementado sim, coloquei logs nos 2 métodos tbem... Fiz debug e não encontrei nada ainda...

Chega até aqui sem problemas, quando invoco o [color=#000000]startUpdatingLocation[/color] não da erro, não loga nenhum dos 2 métodos e fazendo debug tbem não chega a entrar no método.

[CODE]
[locationManager startUpdatingLocation];
[/CODE]

Com certeza o problema é na App, mas ainda não consegui encontrar o ponto, pois sem erro fica difícil encontrar algo.

Mas obrigado pela resposta.

Abs

Editado por sandokan

Participe do debate

Você pode postar agora e se registrar depois. Se você tem uma conta, entre agora para postar com ela.

Visitante
Responder este tópico…

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conta

Navegação

Buscar

Buscar

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.