2013-06-26 23 views
8

Tôi đang cố gắng giả mạo cập nhật vị trí trong Find My Friends với Theos.API riêng tư của iOS để theo dõi vị trí ở chế độ nền sau khi ứng dụng bị giết (như Tìm bạn bè của tôi)

Những gì tôi có cho đến nay:

Khi ứng dụng là trong foreground, tôi đã có thể giả mạo thông báo cập nhật (sử dụng Theos/Logos để treo FMFLocation lớp).

gì là mất tích:

Khi ứng dụng là trong nền hoặc giết, nó vẫn gửi vị trí của tôi đến máy chủ khi bạn tôi yêu cầu vị trí của tôi. Bản cập nhật nền này KHÔNG gọi phương thức cập nhật thường xuyên, vì vậy móc của tôi không hoạt động. Hơn nữa, nó có thể đáp ứng yêu cầu vị trí từ mạng ngay cả khi ứng dụng bị giết. Tôi không nghĩ rằng Apple cho phép hành vi này trong các ứng dụng thông thường.

Tôi nghĩ rằng điều này chỉ có thể được thực hiện với một số API riêng tư. Bất cứ ai có thể chỉ cho tôi đi đúng hướng để tìm ra API/phương thức mà nó đang sử dụng trong nền?

Trả lời

1

Tôi đã tìm ra! Đó là aosnotifyd đang gửi vị trí trong backgournd.

tôi đã kết thúc làm điều này:

#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

Bạn có dự án ví dụ nào giống nhau không? – Maulik

+0

@Maulik Tôi có một bài đăng trên blog về và github repo: http://weishi.github.io/blog/2013/07/19/fixing-find-my-friends-location-shift-in-china/ –

1

Bạn có thể muốn kiểm tra phương pháp -startMonitoringSignificantLocationChanges trong CLLocationMananger (docs).

Như các tài liệu nhà nước:

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.

Vì vậy, về cơ bản bạn cần phải:

  • Đặt phím location như một chế độ nền trong tập tin Info.plist bạn
  • Bắt đầu một cuộc gọi CLLocationMananger
  • startMonitoringSignificantLocationChanges
  • Trên AppDelegate, bạn sẽ nhận được một vị trí trong từ điển thông tin, được khóa với UIApplicationLaunchOptionsLocationKey khi người dùng di chuyển khoảng 500 mét.
  • Trên phương pháp đó, bạn có thể cập nhật vị trí trên máy chủ.
+1

Trên thực tế 'Tìm Friends' của tôi có thể gửi vị trí thuận một yêu cầu từ mạng ngay cả khi ứng dụng được thiệt mạng và không có phong trào được phát hiện, mà rõ ràng là không được kích hoạt bởi' startMonitoringSignificantLocationChanges '. –

Các vấn đề liên quan