2017-04-26 31 views
0

VoIPプッシュ通知のプッシュ通知に関する情報を検索しています。いくつかの点がわかりません。iOS VoIPプッシュ通知(PushKit)

1)ユーザーがアプリケーションを開いていない場合は、電話を受けます。通知からアプリケーションを起動する手段はありますか?

2)アプリケーションは特定のイベントをどのように待機しますか?私の派閥は、例えば彼が誰かから電話を受けるのをどのように知っていますか?

3)私はhttps://github.com/Hitman666/ios-voip-pushのAppdelegateファイルを使用しますが、私の場合は動作しません(多くのエラー)。hereはエラーのプレビューです。ユーザーがアプリケーションを開いていないし、その後、彼はコールを受信した場合

おかげ

+0

見る(https://stackoverflow.com/help/how-to-ask)[質問をする方法]これは広すぎます! – Honey

答えて

2

1)。通知からアプリケーションを起動する手段はありますか?

- 最初にユーザーがアプリアイコンをタップして開くと、デバイスIDだけがプッシュキットペイロードを受信するための登録を取得する必要があります。アプリを開く必要はありません。また、アプリケーションが強制終了した状態で、プッシュキットペイロードごとにローカル通知をスケジュールする必要がある場合にも機能します。

2)アプリケーションは特定のイベントをどのように待機しますか?私のデバイスは、例えば、誰かから電話がかかってきたことをどのように知っていますか?

- プッシュキットペイロードごとにローカル通知をスケジュールする必要があります。

3)私はhttps://github.com/Hitman666/ios-voip-pushのAppdelegateファイルを使用しますが、私の場合は動作しません(多くのエラー)。ここではエラーのプレビューです。

- VOIPベースのアプリケーションのためのpushkitを統合する方法についていくつかのより多くの情報を取得するコード

import UIKit 
import PushKit 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate,PKPushRegistryDelegate { 

    var window: UIWindow? 


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 


     let types: UIRemoteNotificationType = [.Alert, .Badge, .Sound] 
     application.registerForRemoteNotificationTypes(types) 

     self.PushKitRegistration() 

     return true 
    } 

    //MARK: - PushKitRegistration 

    func PushKitRegistration() 
    { 

     let mainQueue = dispatch_get_main_queue() 
     // Create a push registry object 
     if #available(iOS 8.0, *) { 

      let voipRegistry: PKPushRegistry = PKPushRegistry(queue: mainQueue) 

      // Set the registry's delegate to self 

      voipRegistry.delegate = self 

      // Set the push type to VoIP 

      voipRegistry.desiredPushTypes = [PKPushTypeVoIP] 

     } else { 
      // Fallback on earlier versions 
     } 


    } 


    @available(iOS 8.0, *) 
    func pushRegistry(registry: PKPushRegistry!, didUpdatePushCredentials credentials: PKPushCredentials!, forType type: String!) { 
     // Register VoIP push token (a property of PKPushCredentials) with server 

     let hexString : String = UnsafeBufferPointer<UInt8>(start: UnsafePointer(credentials.token.bytes), 
      count: credentials.token.length).map { String(format: "%02x", $0) }.joinWithSeparator("") 

     print(hexString) 


    } 


    @available(iOS 8.0, *) 
    func pushRegistry(registry: PKPushRegistry!, didReceiveIncomingPushWithPayload payload: PKPushPayload!, forType type: String!) { 
     // Process the received push 


    } 

} 

の下に参照してください。

https://github.com/hasyapanchasara/PushKit_SilentPushNotification

関連する問題