?
Solved

How to call a function (method) in Objective C

Posted on 2009-07-13
2
Medium Priority
?
8,770 Views
Last Modified: 2013-11-25
Hi Experts,

I am trying to develop an iPhone application that gets some data from a socket and parses it for display. I basically have it working, but would like to pass some of the logic to a function to have it parse and display the data.

In the code snippets attached I would like to create a function called "parse" and have it work on the string "data".

I have a tried all of the syntax I can think of like:
"void parse(data);", "[parse:data]", "[data:parse]", etc. to call the function

The code is from mainview.m

Thank you in advance.
// Data Received //
NSString *data;
data = [[NSString alloc] initWithFormat: @"%@\n%@", resultText.text, output];
    if (data = @"rt=ok")
    {
         servername.text = data;  //THIS WORKS
    }
    else{
          void parse(data);           // CALL THE FUNCTION FROM HERE
    }
 
 
- (void)parse:data {
    NSLog("PARSING DATA");
    txtsend.text = data;
    return;
}

Open in new window

0
Comment
Question by:enjay99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
AGoodKeenMan earned 1000 total points
ID: 24838095
You almost had it,

[self parse:data];
0
 

Author Closing Comment

by:enjay99
ID: 31602730
Thank you for your excellent response
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question