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 785905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:57:12+00:00 2026-05-14T20:57:12+00:00

The more I develop iPhone apps, the more reusable functions I write. At the

  • 0

The more I develop iPhone apps, the more reusable functions I write. At the moment I just copy them into the .m files that need them. But would it be better to have a separate .m file and #import it instead? I don’t wish to compile a library, I just want to know how other folks have handled this. Thanks.

Clarification: I want other .m files to obtain the external code in such a way that they think it is their own. The selectors and the variables are recognized just as if they were in the target .m file rather than having been injected in some fashion.

Do I put the shared code in both a .m and a .h file? Do I use #import? I don’t want the shared code to be regarded as its own class, needing instantiation.

  • 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-05-14T20:57:13+00:00Added an answer on May 14, 2026 at 8:57 pm

    This is a partial answer to my own question. If I create a class for my helper functions and define the methods with a + instead of a -, then they are “static” or “class” methods. I can call them from within another class without having to create an instance of their own class.

    Let’s say my Class is called MyHelperFunctions, and has the usual MyHelperFunctions.h and MyHelperFunctions.m files. I can declare this method:

       + (int) addOneToThisNumber:(int)MyNum;
    

    And then call it from other classes like so:

       int k = 0;
       int i = [MyHelperFunctions addOneToThisNumber:k];
    

    Of course I need to do this:

       #import "MyHelperFunctions.h"
    

    in the .m file of all classes that want access to those helper functions.

    The reason I say this is a partial answer is that I put a bunch of sqlite3 functionality in my helper class file, but when I call that from another class, I get “out of memory” errors or “library routine called out of sequence” errors.

    Thus, I seem to have created two problems that didn’t exist before: a threading issue as well as a memory issue caused be creating an instance of a database in one class and then passing it to another class to try to open that DB.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What do you think is the best way to develop iphone apps on windows?
I am trying to develop an iphone application using sencha framework .I need to
I've just purchased Xcode 4 and am trying to develop my apps in it.
I've been using Xcode to develop iPhone Apps for a couple of years now.
As I develop more with vim, I find myself wanting to copy in blocks
Using virtualenvwrapper to develop on the CKAN project is a bit more complex than
After reading http://www.pragprog.com/magazines/2010-03/javascript-its-not-just-for-browsers-any-more I'm wondering which is the best IDE to develop server-side javascript
IF someone has to develop the same application for Android and iPhone, is it
I have downloaded xcode and have developed a crud app (on the iphone) that
I want to develop an App that requires wired communication between Web cam type

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.