PBRequester因iOS应用中的错误而失败

iOS*_*Dev 16 ios nsurlerrordomain pbrequester

我的iOS应用程序中遇到了一些奇怪的问题.当我的应用程序打开并且用户按下睡眠/唤醒按钮时,应用程序调用

applicationWillResignActive
applicationDidEnterBackground
Run Code Online (Sandbox Code Playgroud)

当用户右键滑动解锁屏幕时,应用程序调用

applicationWillEnterForeground
applicationDidBecomeActive
Run Code Online (Sandbox Code Playgroud)

之后,它在控制台中输出以下错误:

PBRequester failed with Error Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x1cdfbc00 {NSErrorFailingURLStringKey=https://gsp10-ssl.apple.com/use, NSErrorFailingURLKey=https://gsp10-ssl.apple.com/use, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0x1cddca10 "A server with the specified hostname could not be found."}
Run Code Online (Sandbox Code Playgroud)

我知道此错误表明找不到指定的主机名.但是哪个主机名?它是https://gsp10-ssl.apple.com/use还是我用于Web服务的主机名?

如何调试此错误并确定其来源?

Pat*_*mer 2

我遇到过同样的问题。我将 parse.com 框架集成到我的应用程序中。

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  // Store the deviceToken in the current installation and save it to Parse.
  PFInstallation *currentInstallation = [PFInstallation currentInstallation];
  [currentInstallation setDeviceTokenFromData:deviceToken];
  [currentInstallation saveInBackground];
}

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
  [PFPush handlePush:userInfo];
}
Run Code Online (Sandbox Code Playgroud)

当我将这两个代码块从 AppDelegate 移到我的主 ViewController 文件中后,错误消息消失了......也许它可以帮助你......