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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:55:10+00:00 2026-06-17T08:55:10+00:00

On iOS NSUInteger is a unsigned int , on OSX it is a unsigned

  • 0

On iOS NSUInteger is a unsigned int, on OSX it is a unsigned long. How can I make a print statement like

 NSLog(@"Array has %d elements.",[array count]);

compile on both platforms without a warning? I can of course use an #ifdef #else #endif construct but that will add 4 lines of code. I could also cast the return value to unsigned int. Is there a shorter solution?

  • 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-17T08:55:11+00:00Added an answer on June 17, 2026 at 8:55 am

    How about a cast up to the larger of the two?

    NSLog(@"Array has %ld elements.",(unsigned long)[array count]);
    

    No warning in iOS, and I think it’s a no-op in OSX.

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

Sidebar

Related Questions

On iOS I would like to hold the splash screen up until my app
Beginner iOS dev here. I have a problem in my array. Im making an
Possible Duplicate: How to make app fully working correctly for autorotation in iOS 6?
I'm learning iOS programming from a book, and I've coded an app to make
I saw at the some code from iOS developer. It has some code following:
Can anyone confirm that to support both iOS 6 and iOS 5 there is
How can I attach an object to a control/UIView in iOS so that I
Anyone who's trying the newest iOS 6 beta(version 2 or 3) has the same
Has anyone found a good way to test Google Analytics on iOS? The SDK
I'm trying to learn iOS from an entirely Android background. I would like to

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.