0

구문 분석에서 특정 설치를 얻어야한다고합니다. 나는 그 대상을 가지고 있지 않다. 어떻게 쿼리 할 수 ​​있습니까? iOS 푸시 알림 관련 사항입니다. 이미 deviceId가 있습니다. 그 컬 명령은 무엇입니까?objectId없이 구문 분석 설치를 쿼리/컬링하는 방법

+0

https://www.parse.com/docs/rest#installations- 질의 –

답변

0

개별 사용자에게 푸시를 보내려면 사용자가 로그인 할 때 설치 객체에 몇 가지 추가 정보를 추가해야합니다. 따라서 다른 사용자가 설치를 쿼리하여 특정 사용자를 찾을 수 있습니다.

PFInstallation *installation = [PFInstallation currentInstallation]; 
installation[@"client"] = [KZClient currentClient]; 
installation[@"phone"] = [KZClient currentClient].phoneNumber; 
[installation saveInBackground]; 

및 기타 사용자는 다음과 같이 쿼리하여이 설치 개체를 찾을 수 있습니다 :이처럼 그것을 한 적이

PFUser *friend = [some method to get friend ...]; 
PFQuery *installationQuery = [PFInstallation query]; 
[installationQuery whereKey:@"client" equalTo:friend]; 
PFPush *push = [[PFPush alloc] init]; 
[push setQuery:installationQuery]; 
[push setMessage:@"Test message"]; 
[push sendPushInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { 
}];