1

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

应用程序在应用程序启动结束时应该有一个根视图控制器 wait_fences: failed to receive reply: 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);


    }
   }

从视图中调用此方法时出现此错误确实加载方法

4

2 回答 2

1

您必须在 AppDelegate 中设置 rootController

[self.window setRootViewController:tabBarController];

使用 %i 而不是 %d

int count =[surveyList count];
NSLog(@"Total is %i",count);
于 2012-07-25T09:33:14.800 回答
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];
}    
于 2012-07-25T11:03:20.113 回答