App crashing on changing views after login - iphone

Good morning!
I am very new to iPhone/iPad programming
My app is crashing (signal SIGABRT) after trying to change views after a Login
-(void)checkLogin {
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"LoginData" ofType:#"txt"];
NSString *myText = [NSString stringWithContentsOfFile:filePath];
//Parse lines into an NSArray;
NSArray *results= [myText componentsSeparatedByString:#"\n"];// Assumes Mac line end return
if([txtUsername.text isEqualToString: [results objectAtIndex:0]]&& [txtPassword.text isEqualToString: [results objectAtIndex:1]])
{
Clients * clients = [[Clients alloc] initWithNibName:#"clients" bundle:nil];
[self presentModalViewController:clients animated:YES];
}
else
{
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:#"Login"
message:#"Wrong credentials"
delegate:nil
cancelButtonTitle:#"Close"
otherButtonTitles:nil];
[alert show];
}
}
#end
The app is crashing at this line
[self presentModalViewController:clients animated:YES];
Thank you very much!

Clients * clients = [[AboutUs alloc] initWithNibName:#"clients" bundle:nil];
[self presentModalViewController:clients animated:YES];
I think the first line is where your app gets stuck. turn it into:
Clients *clients = [[Clients alloc] initWithNibName:#"clients" bundle:nil];
[self presentModalViewController:clients animated:YES];
This code should work, but In your question, you put a certain aboutUs in your code.
I don't know what you want to do with this from you question, but if you want to put this AboutUs controller inside your Clients controller, you should use something like:
Clients *clients = [[Clients alloc] initWithRootViewController:aboutUs];
hope this helps you

Have you tried doing it like this:
Clients *myClients = [[Clients alloc] init];
[self presentViewController:clients animated:YES completion:^(void) {
}];
It should work properly. If it still crashes, something in the Clients class is going wrong.

Related

MFMailComposer hangs app - no crash report - happens after users upgrade iOS

EDIT: I eventually contacted Apple DTS. After I provided a stackshot from an affected user, DTS decided I should file a bug with Apple BugReporter. So, at this point, I think it's an issue with MFMailComposer, but it's unresolved. The Apple bug number is 13602051
I have a bug that has been coming up again and again in an app.
Some users who upgrade their iOS version report that they can no longer use the email export in my app, which uses MFMailComposer. The app freezes, and doesn't generate a crash report.
My code is pretty simple, and I can't reproduce the reported bug, but many users have now said this happens after an iOS update. Here is the code:
// using ARC, so no reference counting
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
#autoreleasepool {
if (gpxFilePath) {
NSData *gpx = [NSData dataWithContentsOfFile:gpxFilePath];
[controller addAttachmentData:gpx mimeType:#"text/gpx" fileName:[self cleanFileName]];
gpx = nil;
}
}
[controller setSubject:subject];
[controller setMessageBody:body isHTML:YES];
[[MAP_APP_DELEGATE mainController] presentModalViewController:controller animated:YES];
After this is called, the email view comes up, but then is unresponsive.
I'm using the next code for iOS 6.1 and it works for me.
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc]init];
mailer.mailComposeDelegate = self;
[mailer setSubject:#"subject"];
User *user = [user_array objectAtIndex:1];
NSArray *toRecipients = [NSArray arrayWithObjects:#"mail address", nil];
[mailer setToRecipients:toRecipients];
NSArray *cc = [NSArray arrayWithObjects:#"mail address", nil];
[mailer setCcRecipients:cc];
NSDictionary *dic = [one array objectAtIndex:0];
NSString *description = [dic objectForKey:#"Description"];
NSString *emailBody = description;
[mailer setMessageBody:emailBody isHTML:NO];
[self presentViewController:mailer animated:YES completion:nil];
[mailer release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Failure"
message:#"Your device doesn't support the composer sheet"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
}
Remember that simulator is not able to send e-mail, so alert view will be shown in this case.
Note 1: presentModalViewController is deprecated in iOS 6.0
Note 2: try to send the email without data to check if this is what causes the issue
This should solve your problem.
[[MAP_APP_DELEGATE mainController] presentModalViewController:controller animated:YES];
controller = nil;

How can I convert NSMutableArray into NSString?

I am trying to convert (or copy?) a NSMutableArray into a NSString. I guess my problem is
that I don't really understand the structure of a NSString. After conversion I want to
attached it in email body. Here is my code:
- (IBAction)sendEmail
{
NSLog(#"sendEmail");
[textView resignFirstResponder];
[textView1 resignFirstResponder];
if ([MFMailComposeViewController canSendMail])
{
// set the sendTo address
NSMutableArray *recipients = [[NSMutableArray alloc] initWithCapacity:1];
[recipients addObject:#"example#yahoo.com"];
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:#"Iphone Game"];
NSString *string = [string appendString:[NSString stringWithFormat:"%#", [viewArray objectAtIndex:i]]];
[controller setMessageBody:string isHTML:NO];
[controller setToRecipients:recipients];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Alert"
message:#"Your device is not set up for email." delegate:self cancelButtonTitle:#"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
EDIT:
after reading your comment, it is pretty much clear that what you are trying to do is archiving/unarchiving an array containing objects of various kinds. So, you should try using:
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:array];
to get an NSData object that you can then send as an attachment with an email message (or in whatever other persistency layer you need).
Keep in mind that this approach will work only if the objects stored in the array support the NSCoding protocol (you can check that in the reference for each type you are using: it clearly lists all the supported protocols). Considered that you say that your object are already stored as NSData, there should be no problem. Just archive the array, so you will be able to unarchive it later, if required.
If you have some custom type that does not support NSCoding, you will need to implement it as described in Encoding and Decoding Objects.
OLD ANSWER:
I am not sure I understand your problem, but what about using componentsJoinedByString:
E.g.:
NSString *string = [viewArray componentsJoinedByString:#"\n"];
Doing like this, the content of your array (provided it is made of strings) will be presented as a list of strings. If you use description, your array will be converted into a string without giving you much control on its format (it will add curly braces and other syntactic sugar).
I suspect what you wanted to do was create a loop on all the elements in viewArray and append them to an NSString string. However, as #sergio has suggested, I think componentsJoinedByString would be a better option.
This is what your method would look like with that change, I have also cleaned up some other parts of the method. It looks like there was a memory leak, recipients, in your original version.
- (IBAction)sendEmail
{
NSLog(#"sendEmail");
[textView resignFirstResponder];
[textView1 resignFirstResponder];
if ([MFMailComposeViewController canSendMail])
{
// set the sendTo address
NSArray *recipients = [NSArray arrayWithObject:#"example#yahoo.com"];
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:#"Iphone Game"];
NSString *string = [viewArray componentsJoinedByString:#"\n"];
[controller setMessageBody:string isHTML:NO];
[controller setToRecipients:recipients];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Alert"
message:#"Your device is not set up for email."
delegate:self
cancelButtonTitle:#"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
}
}
This will combine the elements of the viewArray and place a newline \n between each element. You could replace the #"\n" with #"" or #" " depending on exactly what you want to do. If the elements of the array are not NSStrings then the elements description method will be called and the output of that used in the resulting string.
Depends on the format you'd like your string to have. You could always use the array's description like this:
NSString *myString = [myArray description];

iPhone -trouble with a loading data from webservice into a tableview

I am using a Window based application and then loading up my initial navigationview based controller in the appDelegate part - application didFinishLaunchingwithOptions (UPDATED)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
The method of getting the data from the webservice is usually triggered in this method of viewdidload .... in the [self getData]; method.
- (void)viewDidLoad
{
[super viewDidLoad];
if (_refreshHeaderView == nil) {
EGORefreshTableHeaderView *view = [[EGORefreshTableHeaderView alloc] initWithFrame:CGRectMake(0.0f, 0.0f - self.tableView.bounds.size.height, self.view.frame.size.width, self.tableView.bounds.size.height)];
view.delegate = self;
[self.tableView addSubview:view];
_refreshHeaderView = view;
[view release];
}
// update the last update date
[_refreshHeaderView refreshLastUpdatedDate];
[self loadImages];
HUDMB = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUDMB];
HUDMB.dimBackground = YES;
// Regiser for HUD callbacks so we can remove it from the window at the right time
HUDMB.delegate = self;
HUDMB.labelText = #"Loading..";
[HUDMB show:TRUE];
[self getData];
[self.tableView reloadData];
}
Before loading it if the user is not registered/ does not have a credentials present then it takes the user to a login view controller .
- (void)loadView {
[super loadView];
if([Preferences isValid]?YES:NO)
{
}
else
{
int r = arc4random() % 5;
switch (r) {
case 0:
{
loginViewController *sampleView = [[loginViewController alloc] initWithNibName:#"loginViewController" bundle:nil];
[self.navigationController presentModalViewController:sampleView animated:YES];
[sampleView release];
}
break;
case 1:
{
loginViewController *sampleView = [[loginViewController alloc] initWithNibName:#"loginViewController" bundle:nil];
[sampleView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self.navigationController presentModalViewController:sampleView animated:YES];
[sampleView release];
}
break;
case 2:
{
loginViewController *sampleView = [[loginViewController alloc] initWithNibName:#"loginViewController" bundle:nil];
[sampleView setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self.navigationController presentModalViewController:sampleView animated:YES];
[sampleView release];
}
break;
case 4:
{
loginViewController *sampleView = [[loginViewController alloc] initWithNibName:#"loginViewController" bundle:nil];
[sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self.navigationController presentModalViewController:sampleView animated:YES];
[sampleView release];
}
break;
case 3:
{
loginViewController *sampleView = [[loginViewController alloc] initWithNibName:#"loginViewController" bundle:nil];
[sampleView setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self.navigationController presentModalViewController:sampleView animated:YES];
[sampleView release];
}
break;
default:
break;
}
}
}
I think the getdata function is making a lot of troubles. so let me add that and also the corresponding functions i use for data retrieval and serialization.
-(void)getData{
NSLog(#"loggin into call sheet page");
[self getCallSheetData];
NSLog(#"after call sheet");
}
- (void)getCallSheetData
{
NSString *postCMD = #"Blah... Blah... Blah...";
NSMutableData *postDataCMD = (NSMutableData *)[postCMD dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSURL *url = [NSURL URLWithString:[Preferences getURL]];
// NSLog(#"get call Sheet");
NSString *postLengthCMD = [NSString stringWithFormat:#"%d", [postDataCMD length]+1];
// NSLog(#"The CS String: %#",[Preferences retriveSession]);
requestCMD = [ASIHTTPRequest requestWithURL:url];
[requestCMD setURL:url];
[requestCMD addRequestHeader:#"Content-Length" value:postLengthCMD];
[requestCMD addRequestHeader:#"Content-Type" value:#"application/x-www-form-urlencoded"];
[requestCMD addRequestHeader:#"user-Agent" value:#"Mobile 1.4" ];
[requestCMD addRequestHeader:#"Content-Language" value:#"en-US"];
[requestCMD addRequestHeader:#"Accept-Encoding" value:#"gzip"];
[requestCMD addRequestHeader:#"Cookie" value:[Preferences retriveSession]];
[requestCMD setPostBody:postDataCMD];
[requestCMD setDelegate:self];
[requestCMD startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
NSMutableArray *CSArray = [[NSMutableArray alloc] init];
if( [[request responseString] isEqualToString:#"OK"]){
return;
}
// Use when fetching binary data
NSData *responseData = [request responseData];
NSDateFormatter *formatter1=[[NSDateFormatter alloc]init];
[formatter1 setDateFormat:#"yyyy-MM-dd'T'HH:mm:ss'Z'"];
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:#"GMT"];
[formatter1 setTimeZone:gmt];
NSDateFormatter *formatterFinal=[[NSDateFormatter alloc]init];
[formatterFinal setDateStyle:NSDateFormatterMediumStyle];
[formatterFinal setTimeStyle: NSDateFormatterShortStyle];
[formatterFinal setLocale:[NSLocale currentLocale]];
JSONDecoder *jCSArray = [[JSONDecoder alloc]init];
NSMutableArray *theObject = [jCSArray objectWithData:responseData];
// CallSheet= [NSMutableArray arrayWithCapacity:50];
for(id key in theObject)
{
csr = [[CallSheetRecord alloc] init];
// cName,cCompany,cId,cMemberId,crcStatus,crcTarget,cImportance,cLastContact
csr.importance = #"1";
csr.rcstatus = #"1";
csr.rcTarget = #"1";
csr.company = #"";
csr.lastContact= #"";
if([key valueForKey:#"firstName"] != Nil)
{
csr.name = [NSString stringWithFormat:#"%#",[key valueForKey:#"firstName"]] ;
if ([key valueForKey:#"lastName"] != Nil) {
csr.name = [csr.name stringByAppendingString:#" "];
csr.name = [csr.name stringByAppendingString:[NSString stringWithFormat:#"%#",[key valueForKey:#"lastName"]]];
}
}
if([key valueForKey:#"company"] != Nil)
{
csr.company = [NSString stringWithFormat:#"%#",[key valueForKey:#"company"]] ;
}
if([key valueForKey:#"memberId"] != Nil)
{
csr.memberId = [NSString stringWithFormat:#"%#",[key valueForKey:#"memberId"]] ;
}
if([key valueForKey:#"id"] != Nil)
{
csr.id_ = [NSString stringWithFormat:#"%#",[key valueForKey:#"id"]] ;
}
if([key valueForKey:#"lastContact"] != Nil)
{
NSDate *finalDate =[formatter1 dateFromString:[NSString stringWithFormat:#"%#",[key valueForKey:#"lastContact"]]];
//NSString *timeStamp = [formatter1 stringFromDate:[finalDate descriptionWithLocale:[NSLocale currentLocale]]];
//NSLog(#"Time stamp : %#",[finalDate descriptionWithLocale:[NSLocale currentLocale]]);
//NSLog(#"Time stamp : %#",timeStamp);
//csr.lastContact = [key valueForKey:#"lastContact"];
csr.lastContact = [formatterFinal stringFromDate:finalDate];
}
if([key valueForKey:#"importance"] != Nil)
{
csr.importance = [NSString stringWithFormat:#"%#",[key valueForKey:#"importance"]];
}
if([key valueForKey:#"rcStatus"] != Nil)
{
csr.rcstatus= [NSString stringWithFormat:#"%#",[key valueForKey:#"rcStatus"]] ;
}
if([key valueForKey:#"rcTarget"] != Nil)
{
csr.rcTarget = [NSString stringWithFormat:#"%#",[key valueForKey:#"rcTarget"]] ;
}
[CSArray addObject:csr];
}
CSD = [CSArray mutableCopy];
[CSArray release];
[formatter1 release];
[formatterFinal release];
//CallSheetArray = [CSArray mutableCopy];
//[csr release];
[jCSArray release];
[HUDMB hide:TRUE];
[self.tableView reloadData];
}
- (void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
UIAlertView *message = [[[UIAlertView alloc] initWithTitle:#"Hello World!"
message:[NSString stringWithFormat:#"%#",error]
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil]autorelease];
[message show];
}
then right after that i try to load the table with [self getData]; that i get make using webservice call using asiHTTP .. for this question lets say it takes 3 seconds time to get the data and then deserialize it . now... my question is it works out okey in the later runs as I store the username and password in a seure location... but in the first instance.... i am not able to get the data to laod to the tableview... I have tried a lot of things...
1. Initially the data fetch methods was in a diffrent methods.. so i thought that might be the problem as then moved it the same place as the tbleviewController(navigationController)
2. I event put in the Reload data at the end of the functionality for the data parsing and deserialization... nothing happens.
3. The screen is black screen with nothing displayed on it for a good 5 seconds in the consecutive launches of the app.... so could we have something like a MBPorgressHUD implemented for the same.
could any one please help for these scenarios and guidance as to what paths to take from here. ...
Update:
Bounty Just answer 2 of the questions the best you can... The property was a thing i tried but it did not work... but my problem is not that... my problem is my screen is not able to load data from a webservice after i login until i do the "pull to refresh". Next eventualy starting my app takes about 5 seconds to show the screen(till that it shows a black screen)... what is the best way to show the apps Blank screen to the End- user when they make it to the app. I dont want the user to think the app is not working or has adversly affected their phone.
There are a number of potential issues here. The first is related to [self getData] - is this blocking or not?
1. getData is blocking (synchronous)
If this method is blocking (i.e. does not return immediately) then this will explain why you are not seeing anything on the screen for a few seconds. You are currently calling this method in the main thread, so it will stop the UI from being updated until is complete.
You can make it run in the background by doing this:
- (void) getDataInBackgroundThread
{
NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init];
[self getData];
// force the table to redraw - UI operations must be on the main thread
[tableView performSelectorOnMainThread:#selector( reloadData )];
[pool drain];
}
In your main code, now instead of calling [self getData] call [self getDataInBackgroundThread];
2. getData is not blocking (asynchronous)
Even if getData is blocking, if it runs in the main thread it will still cause the UI to hang. Also, if it uses a lot of processor time it will slow down the UI and give the appearance of not running in the background.
To address this issue, you would need make sure the lengthy operation of getData really is not running in the main thread and also put in sleep() calls every so often to give some time for the UI to update.
You still haven't given enough info for people to really help, we're just guessing.
It is highly likely the delay is caused by getData. Try commenting that out or bracket it with NSLog statements to verify.
You should show us more code, specifically what is happening in getData and any delegate or notification handling implementations related to loading data.
You don't need to explicitly call [tableView reloadData] in viewDidLoad. The tableView automatically loads data the first time it is displayed.
As #dmatt said, if you are loading data asynchronously then getData would return immediately with no delay. You would typically would either respond to delegate messages or notifications (depending on how you are loading data) to reload the table when the data is finished loading and serializing.
There are lots of folks on SO who are happy to try and help you if given enough info. Especially when you offer a bounty.

donot open ABPersonViewController

i am trying to open ABPersonViewController at table delegate method (DidSelectRowAtIndex). but when i tap on one of my contact person in table view it shows "obj msg send". help me
here is my code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Fetch the address book
if ((people != nil) && [people count])
{
ABAddressBookRef addressBook = ABAddressBookCreate();
//ABPersonViewController *personController = [[ABPersonViewController alloc] initWithNibName:#"ABPersonViewController" bundle:nil];
ABRecordRef person = (ABRecordRef)[people objectAtIndex:indexPath.row];
ABPersonViewController *personController = [[ABPersonViewController alloc] init];
personController.addressBook = addressBook;
personController.personViewDelegate = self;
personController.displayedPerson = person;
personController.allowsEditing = YES;
//navigationController = [[UINavigationController alloc] init] ;
[self presentModalViewController:personController animated:YES];
//[self.navigationController pushViewController:personController animated:YES];
[personController release];
} else
{
// Show an alert if "KETAN" is not in Contacts
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error"
message:#"Could not find naina in the Contacts application"
delegate:nil
cancelButtonTitle:#"Cancel"
otherButtonTitles:nil];
[alert show];
[alert release];
}
[people release];
}
You are doing an unnecessary release here, CFRelease(person);. You are just getting the value directly from an array so you shouldn't release it. Moreover, the ABPersonViewController object doesn't retain the person object assigned to displayedPerson so this results in an error when it tries to access the object which has been released.
If you want the personview to open in edit mode, in addition to allowsEditing = YES, you need to specify setEditing:YES:
[personController setEditing:YES animated:NO];
Use this line instead of that in your code,
ABPersonViewController *personController = [[ABPersonViewController alloc] initWithNibName:#"ABPersonViewController" bundle:nil];

How to show/hide UIImageView when I want

I'm having a little problem with an iPhone app I'm currently developing.
When the user touch a button, it calls an IBAction named refreshQuestion, which is supposed to show an image hover the screen to ask the user to wait a moment, then it has to call another function, and finally it has to hide the image.
The problem is that the image won't appear. As well as the network activity indicator.
Any help?
Here is the code :
- (IBAction)refreshQuestion:(id)sender{
pleaseWait.hidden = NO;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[self loadData];
pleaseWait.hidden = YES;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
EDIT :
Here is my LoadData function :
- (void)loadData{
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSString * idUtilisateur = [userDefaults objectForKey:#"idUtilisateur"];
NSString * stringUrlQuestion = [NSString stringWithFormat:#"http://www.mywebsiteURL"];
NSURL * urlQuestion = [NSURL URLWithString:stringUrlQuestion];
QuestionParser * parser = [[QuestionParser alloc] init];
[parser parseXMLAtURL:urlQuestion parseError:nil] ;
int nbQuestions = [parser.arrayOfQuestion count];
[parser release];
NSFetchRequest *requete = [[NSFetchRequest alloc] init];
NSEntityDescription *entite = [NSEntityDescription entityForName:#"Question" inManagedObjectContext:self.managedObjectContext];
[requete setEntity:entite];
NSSortDescriptor * sortDescriptor = [[NSSortDescriptor alloc] initWithKey:#"idQuestion" ascending:YES];
NSArray * sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[requete setSortDescriptors:sortDescriptors];
[sortDescriptor release];
[sortDescriptors release];
NSError * error;
NSMutableArray *mutableFetchResult = [[self.managedObjectContext executeFetchRequest:requete error:&error] mutableCopy];
[requete release];
if(mutableFetchResult == nil){
NSLog(#"Erreur viewWillAppear : %#", error);
}
questionDuJour = [mutableFetchResult objectAtIndex:0];
if (nbQuestions == 0){
UIAlertView* alertViewConnection = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Error while retreiving data" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alertViewConnection show];
[alertViewConnection release];
}
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:#"EEEE d MMMM"];
NSLocale * localisation = [[[NSLocale alloc] initWithLocaleIdentifier:#"fr_FR"] autorelease];
[outputFormatter setLocale:localisation];
labelJour.text = [NSString stringWithFormat:#"%#",[outputFormatter stringFromDate:questionDuJour.dateQuestion]];
textQuestion.text = questionDuJour.textQuestion;
citation.text = [NSString stringWithFormat:#"%#",questionDuJour.citation];
labelAuteur.text = [NSString stringWithFormat:#"%#",questionDuJour.auteur];
[outputFormatter release];
NSLog(#"stop animating");
}
I think your code [self loadData] executes in microseconds.
Check by using this code alone,
pleaseWait.hidden = NO;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
EDIT:
Check this, if you still get the same problem check whether you have assigned IBoutlet or not. Because what you are doing is the correct way.
Sounds like everything is executing on the UI Thread. Post your loadData method so we can see what its doing. Chances are you have to convert this method to use one of the asynchronous techniques which will return immediately and allow the UI thread to continue. You can then detect when its done loading the data and change the visibility of the image again.