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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:02:04+00:00 2026-05-25T20:02:04+00:00

I am looking to develop a framework, for which I dont want get into

  • 0

I am looking to develop a framework, for which I dont want get into details.

Suppose if I am having 100+ classes with 1000+ methods in my iPhone application.
In this scenario I want to add NSLog in each method(at start or end or both) of each class.

Manually adding NSLog is possible but is there any better solution?
Like building application in such a way that I can add this Log without me having to do manual work.

Thanks and Regards,


Denis,

Your answer was most useful throughout many forums.
Thanks a lot.

The reason I’m looking for something like this is, we have many client projects and many time it happens that we get some crashing or other issues while QA and UAT. ~80% of them are not reproducible or require some particular scenario. We were using .crash and dsym to track such issues. But it is not that useful in such scenario.

What I’m looking for is providing add hoc build which will log the steps which user has followed so that it will make easy to reproduce such issues.

Currently I am using precompiled headers and first method you have mentioned (searching for the first opening brace then replace it with macro).

I will look into DTrace and objc_msgSend as you mentioned. I will google out these meanwhile if you have any preferred tutorials it will be great.

Thanks and Regards,
😀

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

    So you want to add a trace facility to your code?

    Apple doesn’t provide anything like this. You’ll have to add your trace facility yourself. If your source code style is consistent, this might be relatively easy to do automatically, something like searching for the first opening brace following a line starting with a minus (or plus) sign…

    Alternatively, you might want to use the public Objective-C runtime functions to enumerate all classes and all their methods, then method-swizzle each of them with another one that NSLog before jumping to the original.

    Alternatively, you can take the open source implementation of objc_msgSend and insert a call to NSLog at the beginning. Note that obj_msgSend tail calls into the method, so that will prevent you from adding a call upon return. Be prepared to humongous output of course. You might want to condition your call to NSLog to the value of the selector parameter to objc_msgSend (such as a common prefix).

    Finally, the best way to trace is probably to attach a DTrace probe to the entry to objc_msgSend. For the same tail-call reason mentioned above, you won’t be able to attach a DTrace probe to its return though.

    But the better question is why do you want to do that.

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

Sidebar

Related Questions

I am looking to develop a system in which i need to assign every
I'm desperately looking for a PHP 5 framework that will work best to develop
We want to develop and extensible Android application, and are looking for a way
I've been looking into some mobile development frameworks lately. The app I want to
I'm looking into options for a linear and non-linear programming (optimization) framework. Requirements are:
I'm looking for an object oriented web framework to develop Ajax applications in Scala.
I am looking to work with the XNA framework to develop some simple 2D
I am looking to develop an audio player in C#, but was wondering what
I'm looking to develop an offline version of an application that still needs to
I'm looking to develop a small application on Mac OSX and it will need

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.