ios – 越狱应用程序的Apple Notification Service

我正在创建一个安装在/ Applications中的越狱应用程序.无论我做什么,我似乎无法使Push Notifications工作.

我有:

>在Apple Developer控制台中创建了必要的App ID,
>创建所有必要的证书和条款,
>必要时安装以上,
>使用相应的证书签署应用程序,
>将.MobileProvision文件中找到的内容添加到权限中,
>把头靠在墙上.

症状如下.我成功注册了APNS并获得了设备令牌.设备令牌已成功发送到我的服务器.我的服务器成功连接到APNS服务器,成功发送推送通知到APNS服务器,没有任何类型的投诉,我的应用程序永远不会收到Push消息.它只是迷路了.无论我是使用越狱的ios 7设备还是越狱的ios 8设备进行测试都无关紧要.据我所知,这两款设备都成功获得了其他应用的APNS消息.

我尝试了开发人员和生产设置.

我是否缺少一些必要的越狱应用程序步骤,通常是在定期注册应用程序时为您完成的?系统应用程序是不是能够成为APNS应用程序(这看起来很奇怪)?

这是一些代码.电话侧(斯威夫特):

func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
    if Global.OSVersion() < 800
    {
        application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Alert
                                                     | UIRemoteNotificationType.Badge
                                                     | UIRemoteNotificationType.Sound);
    }
    else
    {
        var types: UIUserNotificationType = UIUserNotificationType.Alert
                                          | UIUserNotificationType.Badge
                                          | UIUserNotificationType.Sound;
        var settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: types,categories: nil);
        application.registerUserNotificationSettings(settings);
    }
    application.beginReceivingRemoteControlEvents();
}

func application(application: UIApplication,didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData)
{
    let bytes: [Byte] = deviceToken.getBytes();
    var token: String = "";
    for byte: Byte in bytes
    {
        token += NSString(format: "%02.2hhx",byte);
    }
    // code to send token to server goes here...
}

func application(application: UIApplication,didReceiveRemoteNotification userInfo: [NSObject : AnyObject],fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void)
{
     let command: String = userInfo["Command"] as String;
     // code to process command goes here...
}

服务器代码(C#):

private bool SendIPhone()
    {
        isSent = false;
        PushBroker pushBroker = new PushBroker();
        try
        {
            pushBroker.OnChannelCreated += pushBroker_OnChannelCreated;
            pushBroker.OnChannelException += pushBroker_OnChannelException;
            pushBroker.OnChannelDestroyed += pushBroker_OnChannelDestroyed;
            pushBroker.OnServiceException += pushBroker_OnServiceException;
            pushBroker.OnNotificationFailed += pushBroker_OnNotificationFailed;
            pushBroker.OnNotificationSent += pushBroker_OnNotificationSent;
            pushBroker.OnNotificationRequeue += pushBroker_OnNotificationRequeue;
            pushBroker.OnDeviceSubscriptionChanged += pushBroker_OnDeviceSubscriptionChanged;
            pushBroker.OnDeviceSubscriptionExpired += pushBroker_OnDeviceSubscriptionExpired;
            pushBroker.RegisterAppleService(new ApplePushChannelSettings(XXXConfig.APNSIsProduction,XXXStatic.APNSCertificate,XXXConfig.APNSPassword));
            AppleNotification notification = new AppleNotification();
            notification.DeviceToken = cloudToPhoneID;
            notification.Payload.Alert.Body = "This is a test";
            notification.Payload.Sound = "Alarm.wav";
            notification.Payload.Badge = 5;
            notification.Payload.CustomItems["content-available"] = new Object[] { "1" };
            notification.Payload.CustomItems["Command"] = new Object[] { "TestCommand" };
            pushBroker.QueueNotification(notification);
        }
        finally
        {
            pushBroker.StopAllServices(); // This will force us to wait until we have sent what's in the queue...
        }
        return isSent;
    }

    void pushBroker_OnNotificationSent(object sender,INotification notification)
    {
        isSent = true;
    }

有很多代码我没有表现出所有可行的代码. SendIPhone始终返回true,并且只有在调用pushBroker_OnNotificationSent时才能将其设置为true.

待遇:

<dict>
    <key>application-identifier</key>
    <string>REMOVEDFORPRIVACY</string>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.team-identifier</key>
    <string>REMOVEDFORPRIVACY</string>
    <key>get-task-allow</key>
    <true/>
    <key>keychain-access-groups</key>
    <array>
        <string>REMOVEDFORPRIVACY</string>
    </array>
</dict>

我错过了什么,或者从这里没有路径?

解决方法

我不测试它,但如果我知道Apple允许iOS根应用程序文件夹中的推送通知(只看“提示”应用程序),那么它可能是证书问题,所以也许这会有所帮助:

http://www.hackthatphone.com/3x/push.html

这是hackctivated iOS设备的教程,没有有效的推送通知证书,但它也可以帮助你.

相关文章

背景 前端时间产品经理决定使用百度统计,使得 工程B 中原统计sdk-友盟统计,需要被去除。之前尝试去除...
结论: alloc负责分配内存和创建对象对应的isa指针; init只是返回alloc生成的对象。 所以alloc后,多次...
更新 如果UI愿意把启动图切割成n份,按一定约束在launchscreen.storyboard中进行排版,启动图效果会更好...
最近在看一本书《Effective OC 2.0》,今天看到有个tip是OC适中循环各自优劣性,作者最终推荐此块循环。...
// // ViewController.m // paintCodeTestOC //gif // Created by LongMa on 2019/7/25. // #import &a...
背景介绍 一般情况下,出于省电、权限、合理性等因素考虑,给人的感觉是很多奇怪的需求安卓可以实现,但...