Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7884453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:48:14+00:00 2026-06-03T04:48:14+00:00

Im developing an iOS application using the newest version of Xcode. The application are

  • 0

Im developing an iOS application using the newest version of Xcode. The application are going to fetch data from an webservice using http requests, and the application is kinda big so there will be many different requests. So, im new into with this objective-c so i wonder how do you create a class which can contain methods that can be accessed all over the application just by creating a new instance of that class in an other class and simply call the method inside the classinstance that you just started.

I mean like, lets say we have a class called Communication.
The communication class contains one method which name is login, it takes two parameters. Username and password.

Then i want from my other class call that method using something like.

Communication com = new Communication();
com.login(username, password)

As i said, im kinda new to objective-c so i would appriciate some help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:48:15+00:00Added an answer on June 3, 2026 at 4:48 am

    Communication.h (Header file)

    #import <Foundation/Foundation.h>
    
    @interface Communication : NSObject {
        NSString *username;
        NSString *password;
    }
    
    -(void) login:(NSString *)username withPassword:(NSString *)password;
    
    @property (nonatomic, retain) NSString *username;
    @property (nonatomic, retain) NSString *password;
    
    @end
    

    Communication.m (Implementation)

    @implementation Communication
    @synthesize username, password;
    
    -(void) login:(NSString *)username withPassword:(NSString *)password {
     // Do your login stuff here
    }
    
    @end
    

    Then using that class would look like this:

    NSString *username = @"hugo";
    NSString *password = @"secret!";
    Communication *communication = |[Communication alloc] init];
    [communication login:username withPassword:password];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an iOS 4 application using iOS SDK latest version and XCode 4.2.
I'm developing an iOS 4 application with latest SDK and XCode 4.2. I'm using
I'm developing a large scale application for iOS 5 using ARC in xcode. The
Iam developing one iPad application in Xcode 4.3 with ios 5 and iam using
I just finished developing my iOs application using Phonegap on xCode 4.1 and i'm
I'm developing an iOS 4 application using latest SDK, XCode 4.2 and ARC .
I'm developing an iOS 4 application using latest SDK and XCode 4.2. I have
I am developing an application(using Xcode 4.2 and iOS-5-SDK) aimed for iOS-4 as well
I have developing an iPhone application using xcode 4 which is compatible with iOS
I'm developing an iOS 4 application with iOS 5.0 SDK and XCode 4.2. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.