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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:13:37+00:00 2026-05-26T17:13:37+00:00

I know I am probably missing something pretty basic here, but I am trying

  • 0

I know I am probably missing something pretty basic here, but I am trying to convert a number entered on a UITextField from a NSString into a NSNumber as follows:

self.currentServer.port = [NSNumber numberWithInt:[addressPortTextField.text doubleValue]];
NSLog(@"Port: %@ / %@", addressPortTextField.text, self.currentServer.port);

The number in self.currentServer.port is 50000

The NSLog shows the following:

Port: 50000 / -15536

I don’t get what I am doing wrong here? I’ve tried with doubleValue, intValue, integerValue.

* I found the Problem **

self.currentServer.port is a coredata field of type Integer16. 50000 is to large for that field size, I updated the database to Integer32 and all is well now.


  • 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-26T17:13:38+00:00Added an answer on May 26, 2026 at 5:13 pm

    This line is wrong:

     self.currentServer.port = [NSNumber numberWithInt:[addressPortTextField.text doubleValue]];
    

    and can be the source of the problem. You are converting the text to double and then saving the value in an int. If you try:

    self.currentServer.port = [NSNumber numberWithInteger:[addressPortTextField.text integerValue]];
    

    it is also important how have you defined the currentServer.port.

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

Sidebar

Related Questions

I know I'm probably missing something easy, but I have a foreach loop and
Here's something I know is probably possible but I've never managed to do In
I know I am probably missing something, but I can't seem to get windows
I am probably missing something obvious, but I'm new to Prototype, coming from jQuery.
I'm probably missing something simple here, but I'm having trouble with the jquery ui
Cited from http://xss-proxy.sourceforge.net/Advanced_XSS_Control.txt : As many here probably know, current XSS attacks typically come
This is probably something very basic, but my Erlang installation is doggedly rejecting my
I'm probably missing something obvious, but is there a way to access the index/count
I know I am probably missing this hugely, but anyone knows why this keeps
I know it probably sounds like very trivial question but I couldn't find any

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.