Parse - No placeholder and field email doesn't work in SignUpViewController - parse-platform

I have a problem in Parse with my signUpView.
When I try with LogInAndSignUpDemo code (the Parse tutorial) it works well.
For my project, I have a button "log in" in my view, when the user selects "log in", I open the LogInviewController. If the user doesn't have an account, he can "sign up".
When he sign up, he has this view : Image of mysignupview
My problem is on this view because I don't have placeholder for password and email fields, and I can't select the email field.
My code :
-(IBAction) bouton_log_in_action:(id)sender
{
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
[signUpViewController setDelegate:self]; // Set ourselves as the delegate
// Assign our sign up controller to be displayed from the login controller
[logInViewController setSignUpController:signUpViewController];
// Present the log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
I don't understand where is the problem, because I use the code I found on Parse documentation...

I found the problem.
It's a bug, it'll be fix in 1.2.21 release...

Related

XCODE : Changing which view controller BACK button segues to

Is there a way to change the "parent" of a view controller so you can specify which view controller the back button will segue to without creating a custom back button?
Or is the only way to create a custom back button with a custom action?
If you have access to the navigation controller, you could manually insert a view controller in to its stack of view controllers [self.navigationController setViewControllers:] before the current view controller. That would allow the navigation controller to perform its regular actions yet still navigate back to your desired view controller.
Try To create a custom button like
UIBarButtonItem * buttonBack = [[UIBarButtonItem alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"Back" ofType:#"png"]] style:UIBarButtonItemStylePlain target:self action:#selector(onBackClick:)];
[self.navigationItem setLeftBarButtonItems:#[buttonBack] animated:YES];
and make a method..
- (IBAction)onBackClick:(id)sender
{
// your code
// Write your code what you want to do...
}

sharing objects between flipside view and main controller view xcode

Our student team is currently working on a iphone app and we are stuck on a section of our program where the user can customise how long the timers in our app run for by inputting the value on the flipside view using a UItextfield. We cant figure out how to update these values in the main view controller from the flipside view controller any help would be greatly appreciated we have looked through a lot of examples and nothing seems to work.
//Inside the FlipsideViewController where the user changes the values in a UITextField
- (IBAction)update:(id)sender {
MainViewController *viewController = [[MainViewController alloc]
InitWithNibName:#"MainViewController" bundle:nil];
viewController.ward1Time = [ward1.text intValue];
viewController.ward2Time = [ward2.text intValue];
viewController.ward3Time = [ward3.text intValue];
viewController.ward4Time = [ward4.text intValue];
}
//Inside the MainViewController where we want to take the input the user put in in the FlipsideViewController
- (IBAction)newGreenWard:(id)sender {
[myWardObject setCurrentTime:ward1Time];
}

Removeallobjects in array from another view? Xcode iOS

Please forgive me is this is too vague. I have an app that has populated arrays based on where the user browses to. One is just all sites visited and is accessible in another viewcontroller and another is all text input in to the textview which is displayed while the user types. I don't know if any of that is important but my question is, I would like to have a settings page that has the option to clear that data. I can do it from the header file in that view its self but not sure how to send the removeallobjects command to other views or arrays.
In each view I have a button to call this:
-(IBAction)clearPreText {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:#"clear all predictive typing?"
message:#"press ok to clear"
delegate: self
cancelButtonTitle:#"cancel"
otherButtonTitles:#"ok", nil];
[alert show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
[pastUrls removeAllObjects];
[[NSUserDefaults standardUserDefaults] setObject:autocompleteUrls forKey:#"PastUrls"];
[self.autocompleteTableView reloadData];
}}
I would like to place those buttons in a new view, a settings page.
Thanks for anything.
Both controllers will have access to the app delegate and the app delegate will have access to each of your controllers. When I need to do something like this, I usually do it through the app delegate.

Multiwindows problem, cocoa

I have a simple application, not document-based. I want to have a login window that allows people to login or add a user, and when they logged in successfully I want it to load the main page. If from the main page you click log out, it should destroy the main page and take you back to login page.
sounds like a simple plan, but for some reason I have a problem.
The way I have it right now, I check if the customer logged in or not in the main file AppDelegate and load different window controller. When customer logs in, I send a notification back to AppDelegate from Login Conntroller and load another window controller for main window.
Something like this:
if([[settings get:#"isLoggedIn"] isEqualToString:#"Yes"])
{
MainController *tmpMainController = [[MainController alloc] initWithWindowNibName:#"MainWindow"];
self.mainController = tmpMainController;
NSWindow *mainWindow = [tmpMainController window];
[mainWindow makeKeyAndOrderFront:self];
[tmpMainController release];
} else {
LoginController *tmpViewController = [[LoginController alloc] initWithWindowNibName:#"LoginWindow"];
self.loginController = tmpViewController;
loginWindow = [tmpViewController window];
[loginWindow makeKeyAndOrderFront:self];
[tmpViewController release];
}
Everything works fine, it displays the correct window. But the weird part happens when I log out from the main page, log in again and log out again. If I do it several times, instead of showing me 1 login window, it draws 2. If I continue the login process, on the second try I get 2 main windows. If I log out again, I see 4 cascade login windows, then I see 5 or 7 main windows. After all windows gets loaded all extra windows start getting destroyed one-by-one. It looks like when new window gets created it draws all old windows, then the new one and then destroys all old ones. I don't know why it happens. Would like some help.
Here is the code from my main controller when customer clicks log out:
-(IBAction)logOutClick:(id) sender
{
[settings set:#"isLoggedIn" value:#"No"];
[[self window] orderOut:self];
[[NSNotificationCenter defaultCenter] postNotificationName:#"NSUserLoggedOutNotification" object: self userInfo: nil];
}
the same thing for login controller:
if ([users verifyUser]) {
[settings set:#"isLoggedIn" value:#"Yes"];
[loginView removeFromSuperview];
[[self window] orderOut:self];
[[NSNotificationCenter defaultCenter] postNotificationName:#"NSUserLoggedInNotification" object: self userInfo: nil];
}
I have "Released when closed" checked off for both windows.
I added new nsnotification center observer every time I log out.
That was the problem.

Prompting the user to logon for encrypted documents

I have encrypted documents. After unarchiving each document, I need to prompt the user to enter the document password from a logon sheet. I have means to validate password entry against file contents (this part is done). If the password is incorrect the document shall be closed. If the password is correct the document window shall be presented with document contents.
When I attempt to load the logon sheet (via its controller) in the document's windowControllerDidLoadNib method I have unrecognized selector error as shown below:
- (void)windowControllerDidLoadNib:(NSWindowController *)aController
{
[super windowControllerDidLoadNib:aController];
if (!newPasswordController){
newPasswordController = [[NewPasswordController alloc] init];
newPasswordSheet = [newPasswordController window];
}
[NSApp beginSheet:newPasswordSheet modalForWindow:[self window]
modalDelegate:self
didEndSelector:#selector(didNewPasswordEnd:returnCode:contextInfo:)
contextInfo:nil];
}
[_NSControllerObjectProxy copyWithZone:]: unrecognized selector sent to instance
The method [NewPasswordController init] is implemented as follows:
-(id)init
{
self = [super initWithWindowNibName:#"NewPassword"];
if (self) {
}
return self;
}
where the logon sheet nib file is called NewPassword.
I wonder what went wrong. What is the best way to solve this problem?
Aside from unrecognized selector issue (which I left with Apple) I managed to address the original issue Prompting the user to logon for encrypted documents and here is the solution.
Note every document is password protected and they could potentially respond to different passwords (so the issue is not 'password protected application' but 'password protected documents').
Simply inject the following code when we are about to read document contents to pop up an application modal window to verify the document password:
- (BOOL)readFromData:(NSData *)data
ofType:(NSString *)typeName
error:(NSError **)outError
{
PasswordController *passwordController = [[PasswordController alloc] init];
NSWindow *passwordSheet = [passwordController window];
NSApplication* app = [NSApplication sharedApplication];
NSInteger iret = [app runModalForWindow:passwordSheet];
NSLog(#"password dialog returned = %ld", iret);
if (iret != 0)
{
[app stop:self];
return NO;
}
[passwordController release];
...
You may also pop up another kind of window when the document is saved the first time in dataOfType, forcing the user to set the document's password.
This issue is answered now.
The issue unrecognized selector was resolved after I constructed the xib file from scratch. This indicates a serious problem though concerning IB in XCode 4, as properties of the sheet and steps taken to create bindings, key-payths etc seemed identical in both cases. Something I have done during interface construction from IB caused a corruption in the xib file in my first attempt.
I'll leave it to forum administration to delete or keep this issue. If it is value to anyone I'll file a bug report with Apple (see below)

Resources