2013-06-26 13 views
8

Teorilerle Find My Friends konum güncellemesini taklit etmeye çalışıyorum. Bugüne kadar ne varUygulama bittikten sonra arka planda yeri izlemek için iOS özel API'si (Arkadaşlarımı Bul)

:

uygulama ön planda içindedir, ben (FMFLocation sınıf kanca Theos/Logos kullanarak) güncelleme mesajı taklit edebildi. arkadaşım konumumu istediğinde

uygulaması veya öldürdü arka planda, hala sunucuya konumumu gönderir: Eksik olan

. Bu arka plan güncellemesi normal güncelleme yöntemini ÇALIŞTIRMAZ, bu yüzden kancam çalışmıyor. Ayrıca, uygulama öldürülse bile ağdan konum isteğine yanıt verebilir. Apple'ın bu davranışa normal uygulamalarda izin verdiğini düşünmüyorum.

Bunun yalnızca bazı özel API'larla yapılabileceğini düşünüyorum. Arka planda hangi API/yöntemin kullanıldığını öğrenmek için bana doğru yönde işaret edebilir misiniz?

cevap

1

Bunu çözdüm! Bu, backgournd içinde konum gönderiyor aosnotifyd var.

bunu yaparken sona erdi:

#import <CoreLocation/CoreLocation.h> 

%hook AOSFindBaseServiceProvider 
-(void)sendCurrentLocation:(id)fp8 isFinished:(BOOL)fp12 forCmd:(id)fp16 withReason:(int)fp20 andAccuracyChange:(double)fp24{ 
    //Mess with (CLLocation *)fp8 here 
    %orig(c,fp12,fp16,fp20,fp24); 
} 
%end 
+0

Aynı proje için örnek projeniz var mı? – Maulik

+0

@Maulik hakkında bir blog yazısı var ve github repo: http://weishi.github.io/blog/2013/07/19/fixing-find-my-friends-location-shift-in-china/ –

1

CLLocationMananger (docs) içinde -startMonitoringSignificantLocationChanges yöntemini kontrol etmek isteyebilirsiniz.

This method initiates the delivery of location events asynchronously, returning shortly after you call it. Location events are delivered to your delegate’s locationManager:didUpdateLocations: method. The first event to be delivered is usually the most recently cached location event (if any) but may be a newer event in some circumstances. Obtaining a current location fix may take several additional seconds, so be sure to check the timestamps on the location events in your delegate method.

After returning a current location fix, the receiver generates update events only when a significant change in the user’s location is detected. For example, it might generate a new event when the device becomes associated with a different cell tower. It does not rely on the value in the distanceFilter property to generate events. Calling this method several times in succession does not automatically result in new events being generated. Calling stopMonitoringSignificantLocationChanges in between, however, does cause a new initial event to be sent the next time you call this method.

If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the locationManager:didUpdateLocations: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your application was launched because of a location event. Upon relaunch, you must still configure a location manager object and call this method to continue receiving location events. When you restart location services, the current event is delivered to your delegate immediately. In addition, the location property of your location manager object is populated with the most recent location object even before you start location services.

In addition to your delegate object implementing the locationManager:didUpdateLocations: method, it should also implement the locationManager:didFailWithError: method to respond to potential errors.

Yani temelde yapmanız gerekenler::

  • bir CLLocationMananger
  • Araması Başlat

    • sizin Info.plist dosyasındaki bir arka plan modu olarak location anahtarını ayarlayın dokümanlar devlet olarak

      startMonitoringSignificantLocationChanges

    • AppDelegate numaranızda, kullanıcılar yaklaşık 500 metre hareket ettiğinde UIApplicationLaunchOptionsLocationKey ile girilen bilgi sözlüğünde bir konum alırsınız.
    • Bu yöntemde, sunucudaki konumu güncelleyebilirsiniz.
  • +1

    Aslında 'uygulaması öldürülür ve hiçbir hareket açıkça' startMonitoringSignificantLocationChanges tetiklediği almayan, algılandığında durumunda bile Friends' ağdan bir istek üzerine konumunu gönderebilir bul '. –

    İlgili konular