iOS推送通知在使用Test Flight进行Ad Hoc分发时无法工作

9

我遇到了一个奇怪的问题...

在我的AppDelegate.m文件中,我有以下代码:

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
    // Override point for customization after application launch.


    // Enable test flight reporting; https://testflightapp.com/sdk/doc/0.8.3/
    [TestFlight takeOff:@"myTestFlightToken"];

    // Let the device know we want to receive push notifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

    return YES;
}

-(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    NSString *tokenAsString = [[deviceToken description] 
                                 stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];

    NSLog(@"Device token: %@", deviceToken);
    User.currentUserPushNotificationToken = tokenAsString;
    [TestFlight passCheckpoint: [NSString stringWithFormat: @"Registered for remote notifications %@", deviceToken]];
}

-(void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    NSLog(@"Failed to get token, error: %@", error);
    [TestFlight passCheckpoint: [NSString stringWithFormat: @"Failed to register for remote notifications %@", error]];    
}

我的团队正在使用Test Flight来在开发人员和利益相关者之间分发临时构建。
当我在自己的iPhone 4上构建应用程序时,应用程序会问我是否希望允许推送通知,并且该应用程序还出现在“设置”>“通知”>“通知中心”中。
到目前为止,一切都很好...
当我创建一个开发ipa并将其分发给团队时,其他用户不会被询问是否希望允许推送通知,也不会出现在“设置”>“通知”中...
有人能想到这可能是为什么吗?
更新
对于分发,我正在使用Team Provisioning Profile构建应用程序,其中"*"代替了应用程序名称的bundle ID - 这可能是问题吗?这是Apple自动生成的Team Provisioning Profile。
1个回答

7

是的,这就是问题所在。您不能在推送通知的应用标识符中使用通配符(否则会向所有应用推送!)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接