2017-03-02 4 views
1

iOS에서 작동하도록 푸시 알림을받을 수없는 Xamarin Forms 앱이 있습니다. Android에서 잘 작동합니다. 장치가 SDK v4.1.0을 사용하여 Urban Airship에 제대로 등록하고 있습니다. ChannelId와 Device Token을 얻을 수 있습니다. Dev 채널에서 푸시 아웃을 보내면 Android 기기는 알림을 받지만 iOS 기기는 알림을받지 못합니다. 도시 비행선에서 전체 메시지 보고서는 메시지가 Android 기기 및이 기기에서 테스트 한 두 가지 iOS 기기에 전달되었음을 보여줍니다. 나는 작은 것을 놓치고 있다고 확신하지만 그것이 무엇인지 알 수는 없다. 아래는 App Delegate의 출처입니다. 내가 본 모범을 보면 아주 솔직합니다.Xamarin Forms iOS 기기가 도시 비행선에서 푸시를받지 않습니다.

using System; 
using System.Collections.Generic; 
using System.Linq; 

using Foundation; 
using UIKit; 
using UrbanAirship; 

namespace -----------.Mobile.iOS 
{ 
    [Register("AppDelegate")] 
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 
    { 
     public override bool FinishedLaunching(UIApplication app, NSDictionary options) 
     { 
      global::Xamarin.Forms.Forms.Init(); 

      UAConfig config = new UrbanAirship.UAConfig(); 
      config.DevelopmentAppKey = "----------------------"; 
      config.DevelopmentAppSecret = "----------------------"; 
      config.ProductionAppKey = "----------------------"; 
      config.ProductionAppSecret = "----------------------"; 

#if DEBUG 
      config.InProduction = false; 
#else 
      config.InProduction = true 
#endif 
      UAirship.TakeOff(config); 
      UAirship.Push.UserPushNotificationsEnabled = true; 
      UAirship.Push.ChannelTagRegistrationEnabled = true; 

      // Write the ChannelId for reference later. 

      Guid urbanAirshipChannelId; 
      UrbanAirshipData uaData = new UrbanAirshipData(); 
      if (Guid.TryParse(UAirship.Push.ChannelID, out urbanAirshipChannelId)) 
      { 
       uaData.UrbanAirshipChannelId = urbanAirshipChannelId; 
       uaData.UrbanAirshipDeviceType = Common.Utilities.Enumerations.eUrbanAirshipDeviceType.iOS; 
      } 
      UAirship.Push.PushNotificationDelegate = PushReceived(); 


      LoadApplication(new App(uaData)); 

      return base.FinishedLaunching(app, options); 
     } 

     private UAPushNotificationDelegate PushReceived() 
     { 
      UAPushNotificationDelegate result = new UAPushNotificationDelegate(); 

      return result; 
     } 



    } 
} 

모든 의견이나 아이디어는 크게 감사하겠습니다. 그러나 https://github.com/urbanairship/xamarin-component/issues/40

장치가 푸시를받지하게하지 않을 것이다 -

답변

0

라인 UAirship.Push.PushNotificationDelegate = PushReceived(); , 그들은 대리인에 대한 강한 참조를 저장하지 않는 도시 비행선의 위임에 문제가 있습니다. 기본적으로 앱이 포 그라운드에있는 경우 푸시 수신시 아무 것도 발생하지 않습니다. 백그라운드에서 알림을 게시합니다. iOS 10의 UAPush 인스턴스에 기본 포 그라운드 알림 옵션을 설정하여 해당 동작을 수정할 수 있습니다.

아직 푸시를받는 데 어려움이있는 경우 Urban Flyships 지원팀에 문의하거나 github에 문제를 게시하십시오. 전체 로그가 필요합니다.

+0

답변 해 주셔서 감사합니다. 나는 질문이있다. iOS에서 예상되는 동작이 다음과 같습니까? 앱에서 포 그라운드를 실행 중이고 푸시가 수신되면 해당 기기는 사용자에게 알리지 않지만 알림은 다른 알림과 함께 표시됩니다. 또한 UAPush 인스턴스에서이 값을 변경할 수 있다고 언급했습니다. 아무 것도 보지 않고 보려고하면 알림 목록을 보았습니다. 문제를 게시해야 할 수도 있습니다. UA에 연락했지만 고객의 서비스 수준에는 지원이 없습니다. – GX2TAP

+0

애플은 앱이 푸시를 처리하고 iOS 10까지 모든 알림을 게시하지 않을 것이라고 생각했습니다. 이제는 전경 프리젠 테이션 옵션을 설정할 수 있습니다. 기본값은 http://docs.urbanairship.com/reference/libraries/ios/latest/Classes/UAPush.html#/c:objc(cs)UAPush(py)defaultPresentationOptions에서 설정할 수 있습니다. 그들은 아마도 커뮤니티 포럼에 게시 할 것이지만 꽤 빨리 응답 할 것입니다. – ralepinski

+0

감사합니다. 나는 그 다음 단계로 나아갈 것이다. 의견을 보내 주셔서 감사합니다. – GX2TAP

0

내게있어서 문제는 내가 포 그라운드에서 앱으로 테스트하고 있었고 iOS가 앱 실행과 함께 알림을 표시하지 않았다는 것이 었습니다. 포 그라운드에서 작동하고 사운드를 생성하려면 다음을 추가해야했습니다.

UAirship.Push.DefaultPresentationOptions = UserNotifications.UNNotificationPresentationOptions.Alert | UserNotifications.UNNotificationPresentationOptions.Sound;