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

  • Home
  • SEARCH
  • 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 913045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:29:16+00:00 2026-05-15T17:29:16+00:00

Im new to writing macros in Xcode and am having a problem writing my

  • 0

Im new to writing macros in Xcode and am having a problem writing my own NSLog replacement. I’ve been using a few examples but want to tweak them slightly, so they act more like Log4.

Im trying to write a 2nd macro (or ideally just a delegate of the first) which takes a log level variable as well as the string and arguments for formatting. But everytime I try and pass a varible (in this case l) I get a SIGART error NSArgumentException. The first macro works fine

#define MLog(s,...) \
[MLog logFile:__FILE__ lineNumber:__LINE__ \
format:(s),##__VA_ARGS__]

#define MLogWithLevel(l,s,...) \
[MLog logFile2:__FILE__ lineNumber:__LINE__ logLevel:l \
format:(s),##__VA_ARGS__]

This is my method definition

+(void)logFile:(char*)sourceFile 
        lineNumber:(int)lineNumber
        format:(NSString*)format, ...;

+(void)logFile2:(char*)sourceFile       
lineNumber:(int)lineNumber
        logLevel:(int)logLevel
        format:(NSString*)format, ...;

The exceptions:

+[MLog logFile2:lineNumber:logLevel::format:]:
unrecognized selector sent to class
0x51600 2010-07-10 10:49:21.408
Celebspotter[34433:207] ***
Terminating app due to uncaught
exception
‘NSInvalidArgumentException’, reason:
‘+[MLog
logFile2:lineNumber:logLevel::format:]:
unrecognized selector sent to class
0x51600’

My test log message:

MLogWithLevel(0: @"log at level %i", 0);

Thanks

  • 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-15T17:29:17+00:00Added an answer on May 15, 2026 at 5:29 pm

    Drop the colon, use a comma:

    MLogWithLevel(0, @"log at level %i", 0);
    // fix here:   ^ 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a custom swing component (something completely new, but think JTree or JList).
I am new to writing programs in c++ and i want to know if
I'm writing a new syscall inside the linux kernel. I want to implement an
Typically when writing new code you discover that you are missing a #include because
We perform updates of large text files by writing new records to a temp
I am writing some new code that will throw a custom exception - I
I'm writing a new daemon, which will be hosted on Debian Linux. I've found
Archaelus suggested in this post that writing a new format routine to handle named
For various reasons, we are writing a new business objects/data storage library. One of
I am writing a curriculum project for students new to Java. It has a

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.