[英]Is it possible to debug my app with adhoc provisioning profile in Xcode?
如您所知,我將“簽名調試”配置文件設置為Adhoc供應配置文件。
如果我在iPhone上運行應用程序,則可以使用iPhone接收后台的遠程推送通知(后台使用分發配置文件,因此必須使用即席或分發配置文件)。
但是每次我在iPhone上運行該應用程序(使用Adhoc配置文件)時,它將斷開連接:
無法啟動“項目名稱”
進程啟動失敗:無法獲得進程xxx的任務
因此,我無法使用Xcode中的真實設備調試我的應用程序(使用Adhoc供應配置文件),有什么辦法嗎?
我的要求是轉到特殊的vc
,在didFinishLaunchingWithOptions
方法中的代碼如下:
// If application is launched due to notification,present another view controller.
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification)
{
[SVProgressHUD showSuccessWithStatus:[NSString stringWithFormat:@"success"]];
PushDetailViewController *detail_push = [[PushDetailViewController alloc] init];
detail_push.isPresentCome = YES;
PushModel *new_model = [PushModel initPushModelWithDic:notification.userInfo];
if (new_model) {
detail_push.pushModel = new_model;
[self.window.rootViewController presentViewController:detail_push animated:NO completion:nil];
}
}else {
//LMLSystemAlertControllerShowSingelButtonWithMessageWL(@"沒有notification 信息", @"確定");
}
return YES;
而且我不知道notification.userInfo
是什么,所以我想調試它,並且如果我使用SVProgressHUD
發出警報,則我的應用程序將崩潰,因為我的iPhone與Xcode SVProgressHUD
連接,所以我無法獲取錯誤信息。
因此,存在一些問題:
notification.userInfo
的內容是什么,這是我從后台返回的推送內容嗎? 嘗試-1
我試圖提醒notification.userInfo
,但是如果我訪問notification.userInfo
,我的應用程序將崩潰,因此我無法獲取它,也不知道它是什么。
嘗試-2
我也使用Xcode-> Deveice查找NSLog信息,什么也沒找到:
對於調試UserInfo:放置NSLOG以打印UserInfo,然后檢查值是否正確輸入。 我知道您無法在Xcode控制台中檢查NSLOG,但可以在Xcode中的“設備”中檢查NSLOG。 Xcode->窗口->設備->在左側面板中選擇您的設備。 在這里您可以看到所有日志。
根據UserInfo詳細信息,您可以驗證代碼是否正確。
要在Adhoc構建模式下調試推送通知有效負載,只需將UIAlertView
放置在所需位置即可。 並可以在iPhone屏幕上看到輸出。 :)
例如您的情況。
NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification)
{
NSDictionary *apsInfo = [notification objectForKey:@"aps"];
// Put AlertView here
UIAlertView *alert =[[UIAlertView alloc]
initWithTitle:@"NotificationPayload"
message:[NSString stringWithFormat:@"%@",apsInfo]
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[alert show];
[SVProgressHUD showSuccessWithStatus:[NSString stringWithFormat:@"success"]];
PushDetailViewController *detail_push = [[PushDetailViewController alloc] init];
detail_push.isPresentCome = YES;
PushModel *new_model = [PushModel initPushModelWithDic:apsInfo];
if (new_model) {
detail_push.pushModel = new_model;
[self.window.rootViewController presentViewController:detail_push animated:NO completion:nil];
}
}
else {
//LMLSystemAlertControllerShowSingelButtonWithMessageWL(@"沒有notification 信息", @"確定");
}
return YES;
完成調試后,請不要忘記評論或刪除此AlertView代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.