Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 申请首次推出疑问_Iphone_Ios - Fatal编程技术网

Iphone 申请首次推出疑问

Iphone 申请首次推出疑问,iphone,ios,Iphone,Ios,我的应用程序有问题。我在mainviewcontroller viewdidload方法中有此代码,用于检查应用程序是否首次启动 NSUserDefaults *padFactoids; int launchCount; padFactoids = [NSUserDefaults standardUserDefaults]; launchCount = [padFactoids integerForKey:@"launchCount" ] + 1; [

我的应用程序有问题。我在mainviewcontroller viewdidload方法中有此代码,用于检查应用程序是否首次启动

NSUserDefaults      *padFactoids;
int                 launchCount;

padFactoids = [NSUserDefaults standardUserDefaults];
launchCount = [padFactoids integerForKey:@"launchCount" ] + 1;
[padFactoids setInteger:launchCount forKey:@"launchCount"];
[padFactoids synchronize];

NSLog(@"number of times: %i this app has been launched", launchCount);

if ( launchCount == 1 )
{

    NSLog(@"this is the FIRST LAUNCH of the myBibleapp");
    // do stuff here as you wish




    UIScrollView_PagingViewController *detailViewController = [[UIScrollView_PagingViewController alloc] initWithNibName:@"UIScrollView_PagingViewController" bundle:nil];

    //detailViewController.firstString = firstString;
    // ...
    // Pass the selected object to the new view controller.

    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];

}
if ( launchCount == 2 )
{
    // do stuff here as you wish

            NSLog(@"this is the SECOND launch of the myBibleapp");
    // do stuff here as you wish

}
如果应用程序第一次启动时将转到UIScrollView_PagingViewController页面,或停留在mainviewcontroller中,我的问题是我需要在maincontroller中取消隐藏勾号图像,以在应用程序第一次启动时显示一些条件。该menz
tickimage.hidden=NO,我把它放在第一个条件下,但我没有从代码中得到任何隐藏。如何做到这一点。

首先,您需要学习如何在XCode中使用断点和调试技术。我建议你先去读一下

。。。已经回来了吗?好。我希望你现在理解这些概念。这是你需要做的

  • padFactoids=[NSUserDefaults standardUserDefaults]上设置断点
  • 单步执行并检查
    padFactoids
    launchCount
    的值
  • padFactoids
    是有效对象吗?launchCount是否为您期望的值
  • 如果其中任何一个都不正确,那么请检查您的代码,看看哪里出了问题。请查阅Apple SDK文档,了解您正在调用的方法
  • 你的应用程序工作
    您究竟在哪里尝试取消隐藏图像?你想让图像只在第一次启动时出现吗?你必须显示代码,在视图(控制器)层次结构中放置此图像的位置和方式。如果如您所说,此图像位于主控制器上,并将detailViewController推到其上,然后你将无法看到图像,除非你把它放进去detailViewController@rokjarc勾号是mainviewcontroller。上面的代码也在mainviewcontroller viewdidload方法中。我从代码中删除了UIScrollView\u PagingViewController,并进行了检查,但幸运的是,您在尝试隐藏图像的位置没有问题。您可以发布您为隐藏图像而编写的代码吗?这真的有点浪费时间,因为您没有显示与您遇到的问题相关的代码。这意味着每个人都只能猜测,直到有人偶然发现这个问题。正如我在回答中所说,您需要学习一些非常基本的调试技术并加以应用。如果您没有显示相关代码,并且您自己也没有尝试检查基础知识,我们怎么知道您的问题是什么呢?firstlaunch选项没有问题,它工作得很好。但我的问题是如果我放置了一个图像。hidden=否;它不会在第一次发布时生效。这是一个与你刚才问的完全不同的问题。但我的答案仍然有效——学习如何调试你的应用程序。这将在将来为你节省很多时间,你会学到很多东西。