Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
hi all

I recently followed a tutorial to create a local login/register system. and if the app is removed the user would have to create a new account

from this i would like to creat a list of events, either from just a manually typed in or from a database if possible, which is easier to update regularly and then users who have the app, tick a box and then the list shows all the users who attended that event.

i found a tutorial on how to create a uilist if thats what i need to start, just need to know how to do the other stuff.

Thanks

EDIT - followed this tutorial, if anyone knows how to store the image once uploaded then that would be fantastic
https://www.youtube.com/watch?v=-73kFhnis-w
 
Last edited:

larswik

macrumors 68000
Sep 8, 2006
1,552
11
If you have no programming experience you are actually doing yourself a disservice by learning in this method. I started to learn like this and wanted to expand on projects, like yours from tutorials. The monkey see monkey do tutorial approach doesn't mean monkey can understand what is happening :)

From experience, one of 2 things will happen. One you will give up thinking programming is to hard as you want to do more and more and it gets harder and harder. Or two, you'll discover that trying to learn programming from quick tutorials is not the way and start at the ground floor and build from there.

Get a good book on C and start on the ground floor. I had an app in the app store in my second year. You'll never get it unless you truly grasp the basics first.

The good part of starting at the ground floor is you can then more easily learn other languages. Took me a few days to get comfortable with PHP lingo.
Code:
success = ((good C Book + asking questions on this Forum all the time) * time);
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
I agree with larswick that you will have a rough time making a good app from YouTube tutorials. If you don't understand the code that you are writing, then the hard work you are doing now won't help you in the future because you have not learned very much and you're completely reliant on someone else's ideas. There are so many awesome things that you can dream up and create all by yourself without a tutorial off of YouTube if you learn Objective-C. I only started in May and I am already making apps without anyone else's assistance. They are not production level apps by any means, but I am gaining an enormous amount of knowledge and experience from building them that will benefit my future apps.

Taking the time to complete a good iOS development course will also save you time in the long run. For example you recently made a post asking how to send days from one view controller to another. This is very easy to do once you have learned the basics of the language (which doesn't take very long). Learning the actual Objective C language only took me a few weeks, and once you know the fundamentals of the language, you can start to guess at how things like the prepareForSegue method work.

I'm not sure that I would start with C. There are a lot of good courses out there for iOS development that start from the ground upand teach you objective C along with the most useful C bits thrown in. I would agree that it would be ideal too start with a background in C but I don't think it is necessary, and it's definitely not faster
 
Last edited:

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
I actually have a programming degree, and found these tutorial videos really easy to understand but only go so far. It also hard to put into a words to what i want in YouTube.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I actually have a programming degree, and found these tutorial videos really easy to understand but only go so far.

That is why you need to step back from the real coding for a while and learn the fundamentals of iOS / Objective-C programming. That foundation will be key in your being able to progress quicker.
 

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
I found the videos better than books and as i go along i understand more, so this is why i want to know how to do a have uilist that when you click into it it shows everyapp user part of that group/event
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I found the videos better than books and as i go along i understand more, so this is why i want to know how to do a have uilist that when you click into it it shows everyapp user part of that group/event

What do you mean by "uilist"? That is not a part of the UIKit.

Can you post a link to this tutorial you followed? When referencing resources that you are using, it's courteous to those you seek help from to provide as much detail about those resources as you can. For books, that means title, edition, author and chapter & page number, if necessary. For online tutorials, a link to the tutorial. Etc.
 

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
sorry, I meant a tableview? just a normal list of items, in my case will be events e.g reading festival

and when the user clicks into they have the option to tick a box to say they attended this event. and then it shows all the users that have ticked that box and users can post there comments about the event or chat to people.
 

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
I followed this tutorial,very good one
https://www.youtube.com/watch?v=ITUI7fukRO8

I am using events instead of landmarks

my app now still has the log in but now uses a navigation controller.

at the moment its all working fine except when I hit back to go to the lof in screen the user profile picture is gone. but when the I have to the next screen and gone back it is still there. is there a way to have the image there all the time and

is there a way to get the array data downloaded from a list online so everytime the app loads it checks for an updated list?

then in the DetailView outlined in part 3 of that tutorial i want to know how to add a tick box that will show that the user attended the event they are viewing
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
I followed this tutorial,very good one
https://www.youtube.com/watch?v=ITUI7fukRO8

I am using events instead of landmarks

my app now still has the log in but now uses a navigation controller.

at the moment its all working fine except when I hit back to go to the lof in screen the user profile picture is gone. but when the I have to the next screen and gone back it is still there. is there a way to have the image there all the time and

is there a way to get the array data downloaded from a list online so everytime the app loads it checks for an updated list?

then in the DetailView outlined in part 3 of that tutorial i want to know how to add a tick box that will show that the user attended the event they are viewing

Downloading data into an app from the Internet is reaching a level of complexity that takes most new iOS developers a while to reach. I don't think you should be attempting it at this point. It isn't that hard, but you have to have a very solid understanding of objective c. I have never done it myself, so my knowledge is lacking (to put it charitably), though I do intend to start Doug stuff like this soon. You could do it by setting up an online MySQL server with a PHP interface and use JSON and NSJSONSerialization to exchange data with it.
 
Last edited:

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
I see, I'll look into that

what about the other features of keeping the profile picture chosen all the time and having a tick box that shows all the users who have the app who have attended that event
 

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
what would be a be an easy way of showing it. don't really want it to be a wall of text
 

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
I've decided to use the facebook sdk so the profile pic problem will soon whats the syntax to show the facebook profile pic. but my issue is that I implemented this code from a separate program that worked but now it doesn't.

I hit the log in button and it says the app is already authorized. then hit okay and it just goes back to to the first screen. without logging in :confused:

if it makes any difference I did have a local login/register still in place that uses the push using a navigation controller

//viewcontroller.h
Code:
#import <UIKit/UIKit.h>
#import <FacebookSDK/FacebookSDK.h>

@interface ViewController : UIViewController<FBLoginViewDelegate>

@property (weak,nonatomic) IBOutlet UIButton *registerBtn;
@property (weak,nonatomic) IBOutlet UIButton *loginBtn;
@property (weak,nonatomic) IBOutlet UITextField *usernameField;
@property (weak,nonatomic) IBOutlet UITextField *passwordField;
@property (weak,nonatomic) IBOutlet UITextField *reEnterPasswordField;

@property (weak,nonatomic) IBOutlet FBLoginView *loginView;

- (IBAction)registerUser:(id)sender;
- (IBAction)LoginUser:(id)sender;


@end

//viewcontroller.m
Code:
#import "ViewController.h"
#import "loggedViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    self.loginView.readPermissions = @[@"public_profile", @"email", @"user_friends"];

    
    UIBarButtonItem *NewBackButton =[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleBordered target:nil action:nil];
    [[self navigationItem] setBackBarButtonItem:NewBackButton];
    
    [super viewDidLoad];
	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if (![defaults boolForKey:@"registered"]) {
        NSLog(@"no user registered");
        _loginBtn.hidden = YES;
    }
    else {
        NSLog(@"user is registered");
        _reEnterPasswordField.hidden = YES;
        _registerBtn.hidden = YES;
    }
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)registerUser:(id)sender {
    if ([_usernameField.text isEqualToString:@""] || [_passwordField.text isEqualToString:@""] ||
        [_reEnterPasswordField.text isEqualToString:@""]){
        UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Ooops" message:@" You must complete all fields" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [error show];
    }
    else{
        [self checkPasswordsMatch];
    }
}

-(void) checkPasswordsMatch {
    if ([_passwordField.text isEqualToString:_reEnterPasswordField.text]) {
        NSLog(@"passwords match!");
        [self registerNewUser];
    }
    else{
        NSLog(@"passwords don't match");
        UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Ooops" message:@" passwords don't match" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [error show];
    }

}
- (void) registerNewUser {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    
    [defaults setObject:_usernameField.text forKey:@"username"];
    [defaults setObject:_passwordField.text forKey:@"password"];
    [defaults setBool:YES forKey:@"registered"];
    
    [defaults synchronize];
    
    UIAlertView *success = [[UIAlertView alloc] initWithTitle:@"Success" message:@" Your profile has been created!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [success show];
    
    [self performSegueWithIdentifier:@"login" sender:self];

}

-(IBAction)LoginUser:(id)sender {
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    
    if ([_usernameField.text isEqualToString:[defaults objectForKey:@"username"]] && [_passwordField.text isEqualToString:[defaults objectForKey:@"password"]]) {
        //_usernameField.text = nil;
        _passwordField.text = nil;
        [self performSegueWithIdentifier:@"login" sender:self];
        
    }
    else {
        NSLog(@"passwords don't match");
        UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Ooops" message:@"Your username or password does not match" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [error show];

    }
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.destinationViewController isKindOfClass:[loggedViewController class]])
    {
        loggedViewController *viewController = segue.destinationViewController;
        viewController.userName = self.usernameField.text;
        
    }
}


- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user
{
    NSLog(@"%@", user.name);
}

- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView
{
    NSLog(@"You are logged in! :) ");
    
}

- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView
{
    NSLog(@"You are logged out! :( ");
}

- (void)loginView:(FBLoginView *)loginView handleError:(NSError *)error
{
    NSString *alertMessage, *alertTitle;
    
    if ([FBErrorUtility shouldNotifyUserForError:error])
    {
        alertTitle = @"Facebook error";
        alertMessage = [FBErrorUtility userMessageForError:error];
        
    }
    else if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryAuthenticationReopenSession)
    {
        alertTitle = @"Session Error";
        alertMessage = @"Your current session is no longer valid. Please log in again.";
        
    }
    else if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryUserCancelled)
    {
        NSLog(@"user cancelled login");
        
    }
    else
    {
        alertTitle  = @"Something went wrong";
        alertMessage = @"Please try again later.";
        NSLog(@"Unexpected error:%@", error);
    }
    
    if (alertMessage)
    {
        [[[UIAlertView alloc] initWithTitle:alertTitle
                                    message:alertMessage
                                   delegate:nil
                          cancelButtonTitle:@"OK"
                          otherButtonTitles:nil] show];
    }
}

@end
 

JohnsonK

macrumors regular
Mar 6, 2014
142
0
Thought you said you understood objective-c perfectly... :p

I don't see where you try to authenticate using facebook. All I see is your code saving username and password to NSUserDefaults.
 

Dookieman

macrumors 6502
Oct 12, 2009
390
67
I don't see anything in your code that actually connects to facebook or uses its delegate methods to login. Everything you have there just checks to see if the passwords match. Like JohnsonK said, all you do is save the user/password to NSUserDefaults, which not recommended at all. It's stored as plain text and can very easily be retrieved by someone else.

I'm not sure how facebook SDK works, but typically you are given a login token to store, not the user/password. After you have the login token you can use the API.

Did you forget to bring some additional methods over?
 
Last edited:

tfellas

macrumors member
Original poster
Sep 15, 2014
31
0
sorry forgot to add the AppDelegate.m

Code:
#import "AppDelegate.h"
#import <FacebookSDK/FacebookSDK.h>


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    [FBLoginView class];
    return YES;
}
							
- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.