测试iphone应用程序时出现未知错误

时间:2012-07-25 09:31:49

标签: iphone xcode

我正在测试xcode中的iphone应用程序,但它正在给出unkonwo错误

应用程序在应用程序启动结束时应该有一个根视图控制器 wait_fences:未收到回复:10004003

我不知道为什么在加载视图时会破坏应用程序并发出此错误

 My code where it breaks 

    - (void)viewDidLoad {
      [super viewDidLoad];
      if(!surveyList){
      surveyList=[[NSMutableArray alloc]init];
       }

      [self getSurveyList];

       }

      - (void)getSurveyList {

       NSString*user_id=user_id;
       NSLog(user_id);
      NSString *url=[NSString stringWithFormat:@"http://celeritas-solutions.com/emrapp/surveyDescription.php?user_id=%@",user_id];


    NSArray *tempArray =[[DataManager staticVersion] startParsing:url];

   for (int i = 0; i<[tempArray count]; i++) {

    id *item = [tempArray objectAtIndex:i];
    NSDictionary *dict = (NSDictionary *) item;
    ObjectData *theObject =[[ObjectData alloc] init];
    [theObject setSurvey_title:[dict objectForKey:@"survey_Title"]];
    [theObject setSurvey_Description:[dict objectForKey:@"survey_Description"]];    
    [theObject setDate_Created:[dict objectForKey:@"date_Created"]];




    [surveyList addObject:theObject];
    [theObject release];
    theObject=nil;




    int count =[surveyList count];
    NSLog(@"Total is %d",count);


    }
   }

从view do load方法

调用此方法时出现此错误

2 个答案:

答案 0 :(得分:1)

您必须在AppDelegate中设置rootController

[self.window setRootViewController:tabBarController];

使用%i代替%d

int count =[surveyList count];
NSLog(@"Total is %i",count);

答案 1 :(得分:0)

您必须在AppDelegate.m文件中设置以下方法。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:  (NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]  autorelease];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease];
} else {
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease];
}
UINavigationController *navigation =[[UINavigationController alloc]initWithRootViewController:self.viewController];
 navigation.navigationBar.hidden=YES;
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
}