data is not loading in tableView and not updating profile - ios

I am new in objective C.Execute this Program ON Clicking on button"Click here to sell your Gold now"
It will lunch you to dashboard.In dashboard select Transaction History.I have fetchNewHothistory function in TransactionHistoryViewController.m file responsible for fetching data from url and displaying it onto the viewcontroller file
-(void)fetchNewHothistory
{
NSTimer *t = [NSTimer scheduledTimerWithTimeInterval:1.0
target: self
selector:#selector(mytimerChecking:)
userInfo: nil repeats:NO];
NSMutableDictionary *paramDict=[NSMutableDictionary dictionary];
[paramDict setObject:#"ios" forKey:#"request"];
[paramDict setObject:[NSString stringWithFormat:#"%#",currentUser.user_id] forKey:#"user_id"];
[paramDict setObject:[NSString stringWithFormat:#"%#",self.currentLimitNew] forKey:#"limit_start"];
[GeneralWebservices webserviceMainSplashCall:paramDict webserviceName:Webservice_TransactionHistory OnCompletion:^(id returnDict, NSError *error) {
if ([returnDict[#"success"] intValue] ==1)
{
// UIAlertView* alert = [[UIAlertView alloc] init];
// [alert setTitle:#"RECORD FOUND"];
// // [alert setMessage:returnDict[#"message"]];
// [alert addButtonWithTitle:#"OK"];
// [alert show];
[history addObjectsFromArray:returnDict[#"data"]];
self.currentLimitNew=[NSString stringWithFormat:#"%#",returnDict[#"limit_start"]] ;
[historyTableView reloadData];
}
else
{
UIAlertView* alert = [[UIAlertView alloc] init];
[alert setTitle:#"RECORD FOUND"];
//[alert setMessage:returnDict[#"message"]];
[alert addButtonWithTitle:#"OK"];
[alert show];
}
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[historyTableView.pullToRefreshView stopAnimating];
[historyTableView.infiniteScrollingView stopAnimating];
}];
}
Issue -1
Record found but nothing displayed on Viewcontroller on selecting the Transaction History.The How to display record onto viewcontroller?
Issue -2
In on selecting Profile the ProfileViewController.m is executed .On updating the user profile .It does not updates .It remain buffering .How to perform profile update .
you can download the project from this link .https://drive.google.com/file/d/1daW4veZAI21b8TqKFHauSFTboHKJceaG/view?usp=sharing

Try this:
dispatch_async(dispatch_get_main_queue(), ^{
[historyTableView reloadData];
});

Related

How to redirect to home page after SCLAlertView showWaiting alert?

I would like to show a SCLAlertView alert and after few seconds, it will disappear and redirect to other viewcontroller. But now what i did is after click on "Done" button, the action only can be executed. Any idea? Please help.
Here is my code:-
-(IBAction)submitButtonDidPressed:(id)sender {
NSString *userName = [NSString stringWithFormat:#"Welcome back %#", txtUsername.text];
SCLAlertView *alert = [[SCLAlertView alloc] init];
[alert addButton:#"Done" target:self selector:#selector(clickLogin:)];
alert.customViewColor = ThemeBlueColor;
[alert showWaiting:self title:#"Welcome" subTitle:userName closeButtonTitle:nil duration:2.0f ];
}
-(void) clickLogin:(UIButton*)sender
{
int index = 0;
self.tabBarController.selectedIndex = index;
[self.tabBarController.viewControllers[index] popToRootViewControllerAnimated:NO];
}
You can use alertIsDismissed to call navigation like this:
-(IBAction)submitButtonDidPressed:(id)sender {
NSString *userName = [NSString stringWithFormat:#"Welcome back %#", txtUsername.text];
SCLAlertView *alert = [[SCLAlertView alloc] init];
[alert addButton:#"Done" target:self selector:#selector(clickLogin:)];
alert.customViewColor = ThemeBlueColor;
[alert showWaiting:self title:#"Welcome" subTitle:userName
closeButtonTitle:nil duration:3.0f ];
[alert alertIsDismissed:^{
[self clickLogin:nil];
}];
}

profile is not updating

you can download this project from this link .https://drive.google.com/file/d/1daW4veZAI21b8TqKFHauSFTboHKJceaG/view?usp=sharing
Execute this Program Clicking on button"Click here to sell your Gold now" enter the
username :hermon_yonaito#bullionscope.com
password :Wau2017?
On selecting "Profile" the ProfileViewController.m is executed.On updating the user profile updateButtonTap function is executed.It does not update.It remains buffering.How to perform profile update?
here is updateButtonTap from ProfileViewController.m
- (IBAction)updateButtonTap:(UIButton *)sender
{
[self.view endEditing:YES];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[selectedValues setObject:#"ios" forKey:#"request"];
[selectedValues setObject:[NSString stringWithFormat:#"%#",currentUser.user_id] forKey:#"user_id"];
[selectedValues setObject:postalAddressTextfield.text forKey:#"address"];
[selectedValues setObject:mobileTextfield.text forKey:#"user_mobile"];
[selectedValues setObject:question1Textfield.text forKey:#"user_answer_1"];
//[selectedValues setObject:question2Textfield.text forKey:#"user_answer_2"];
[selectedValues setObject:villageTextfield.text forKey:#"user_village"];
[GeneralWebservices webserviceCallWithData:selectedValues webserviceName:Webservice_ProfileUpdate dataToPost:imageData imageName:imageName OnCompletion:^(id returnDict, NSError *error) {
if ([returnDict[#"success"] intValue] ==1)
{
// UIAlertView* alert = [[UIAlertView alloc] init];
// [alert setTitle:#"Updated Successfully"];
// // [alert setMessage:#"Updated Successfully"];
// [alert addButtonWithTitle:#"OK"];
// [alert show];
}
else
{
UIAlertView* alert = [[UIAlertView alloc] init];
[alert setTitle:#"Updated Successfully"];
//[alert setMessage:returnDict[#"message"]];
[alert addButtonWithTitle:#"OK"];
[alert show];
}
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
}];
}

Youtube videos failed to upload after upgrading to xcode7

- (void)uploadTicket:(GDataServiceTicket *)ticket
finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
error:(NSError *)error
{
NSLog(#"ticket");
UIButton *uploadButton = (UIButton *)[backgroundImage viewWithTag:10];
UIButton *cancleButton = (UIButton *)[backgroundImage viewWithTag:20];
if (error == nil)
{
// tell the user that the add worked
NSLog(#"Video Successfully Uploaded to Youtube");
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSNumber *uploadedToYouTube = [defaults objectForKey:#"uploadedToYouTube"];
if(nil == uploadedToYouTube)
{
[defaults setObject:[NSNumber numberWithBool:YES] forKey:#"uploadedToYouTube"];
[defaults synchronize];
}
NSNumber *userOpenedYoutubeView = [defaults objectForKey:#"userOpenedYoutubeToUnlockTheme"];
if(nil != userOpenedYoutubeView)
{
// [defaults setBool:NO forKey:#"Unlock_Theme"];
[defaults setObject:[NSNumber numberWithBool:NO] forKey:#"Unlock_Theme"];
[defaults synchronize];
UIAlertView *alrtView = [[UIAlertView alloc] initWithTitle:#"Congrats...!" message:#"Your new theme is Unlocked" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alrtView show];
[alrtView release];
[self removeFromSuperview];
}
else
{
UIAlertView *alrtView = [[UIAlertView alloc] initWithTitle:#"Success...!" message:#"Your Video is successfully uploaded to Youtube" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alrtView show];
[alrtView release];
[self removeFromSuperview];
}
}
else {
NSLog(#"Fails to upload Video to Youtube");
UIAlertView *alrtView = [[UIAlertView alloc] initWithTitle:#"Sorry" message:#"Fails to upload video to Youtube. Please try again" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alrtView show];
[alrtView release];
}
mProgressView . hidden = YES;
uploadButton . hidden = NO;
cancleButton . enabled = YES;
[mProgressView setProgress: 0.0];
[self setUploadTicket:nil];
}
Every time i try to upload it is showing alert message "failed to upload". I don't get why it is showing like that. Before upgrading to Xcode 7 it works fine. Anyone know please help me.

UIAlertView seems to freeze application when uploading data to Parse.com

Hello I am using parse to help with the backend of my iOS app and I created a button that will save my text in my textfields and upload it to the cloud when I click a button.
The code for the button and the alert that pops up is as follows
- (IBAction)savebutton:(id)sender {
// Create PFObject with recipe information
PFObject *recipe = [PFObject objectWithClassName:#"GolfTimes"];
[recipe setObject:_nameTextField.text forKey:#"Name"];
[recipe setObject:_prepTimeTextField.text forKey:#"MemberNumber"];
[recipe setObject:_NumberOfGolfers.text forKey:#"NumberOfGolfers"];
[recipe setObject:_RequestedTime.text forKey:#"RequestedTime"];
NSArray *ingredients = [_ingredientsTextField.text componentsSeparatedByString: #","];
[recipe setObject:ingredients forKey:#"Telephone"];
// Show progress
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeIndeterminate;
hud.labelText = #"Sending...";
[hud show:YES];
// Upload recipe to Parse
[recipe saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
[hud hide:NO];
if (!error) {
// Show success message
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Request Sent" message:#"We will get back to you with confirmation." delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alert show];
// Notify table view to reload the recipes from Parse cloud
[[NSNotificationCenter defaultCenter] postNotificationName:#"refreshTable" object:self];
// Dismiss the controller
[self dismissViewControllerAnimated:YES completion:nil];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Upload Failure" message:[error localizedDescription] delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alert show];
}
}];}
Although the data does send properly and the view controller does close as I made it do, the Alert seems to freeze the app and I cannot click the "Ok" most of the time. When I do click the "OK" button the app simulator shuts down.
Any suggestions or help?
I believe you need to dispatch the UIAlertView to the main thread like so when you want to show them: EDIT: You can't have the delegate of the UIAlertView be on the UIViewController you just dismissed! That's why it's crashing; setting the delegate to: nil should fix that.
dispatch_async(dispatch_get_main_queue(),^
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Request Sent" message:#"We will get back to you with confirmation." delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil, nil];
[alert show];
[[NSNotificationCenter defaultCenter] postNotificationName:#"refreshTable" object:self];
[self dismissViewControllerAnimated:YES completion:nil];
});

IOS flicker in SDK6.1 but not in 5.X or earlier

I updated my app which was created one year later for SDK 5.X, but now, I get a terrible problem.In the app, using MBProgressHUD to download files from the server, and show an UIAlerView when it finished. but, thus, the view flicker, Someone saied that the UIAlertView should disappeared on the main thread, my code is like this :
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithWindow:[[WNMAppDelegate appDelegate] window]];
hud.labelText = #"Please wait...";
[[[WNMAppDelegate appDelegate] window] addSubview:hud];
[hud showAnimated:YES whileExecutingBlock:^{
[self progressHudMethodForCheckIn:dic];
} completionBlock:^{
[hud removeFromSuperview];
[hud release];
if ([[dic allKeys] count])
{
NSString *key = [[dic allKeys] objectAtIndex:0];
[self alertMessage:[dic objectForKey:key] withTitle:key];
}
else
{
[self alertMessage:#"Succeed sign in" withTitle:#"Nice"];
}
}];
[dic release];
- (void)alertMessage:(NSString *)message withTitle:(NSString *)title{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:title
message:(NSString *)message
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
can someone help me? Thank you.

Resources