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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:33:53+00:00 2026-05-26T01:33:53+00:00

How do I pass an unknown type (?) object to a function and then

  • 0

How do I pass an unknown type (?) object to a function and then set it to a local ones value in objective-c? The unknown object is an n-th item of a JSON value. I use the JSON framework.

[giveMeTheNthObj:[items objectAtIndex:indexPath.row]]
...
- (void)giveMeTheNthObj:(id)o { 
    Classname *local = o;
}

The above fails. I think because the local is a pointer that should point to a Classname type. What should be the type of the local variable?

The error log:

GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul  1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".Attaching to process 37438.
2011-09-30 16:39:21.649 Navig[37438:b303] -[UILabel copyWithZone:]: unrecognized 
selector sent to instance 0x4b949a0
2011-09-30 16:39:21.652 Navig[37438:b303] *** Terminating app due to uncaught exception 
'NSInvalidArgumentException', reason: '-[UILabel copyWithZone:]: unrecognized selector 
sent to instance 0x4b949a0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dde5a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f32313 objc_exception_throw + 44
    2   CoreFoundation                      0x00de00bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x00d4f966 ___forwarding___ + 966
    4   CoreFoundation                      0x00d4f522 _CF_forwarding_prep_0 + 50
    5   CoreFoundation                      0x00d3edca -[NSObject(NSObject) copy] + 42
    6   UIKit                               0x000de18b -[UIViewController setTitle:]  95
    7   Foundation                          0x007b05e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    8   UIKit                               0x0022c30c -[UIRuntimeOutletConnection connect] + 112
    9   CoreFoundation                      0x00d548cf -[NSArray makeObjectsPerformSelector:] + 239
    10  UIKit                               0x0022ad23 -[UINib instantiateWithOwner:options:] + 1041
    11  UIKit                               0x0022cab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    12  UIKit                               0x000e2628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
    13  UIKit                               0x000e0134 -[UIViewController loadView] + 120
    14  UIKit                               0x000e000e -[UIViewController view] + 56
    15  UIKit                               0x000de482 -[UIViewController contentScrollView] + 42
    16  UIKit                               0x000eef25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
    17  UIKit                               0x000ed555 -[UINavigationController _layoutViewController:] + 43
    18  UIKit                               0x000ee7aa -[UINavigationController _startTransition:fromViewController:toViewController:] + 326
    19  UIKit                               0x000e932a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
    20  UIKit                               0x000f0562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
    21  UIKit                               0x089b9c36 [UINavigationControllerAccessibility(SafeCategory) pushViewController:transition:forceImmediate:] + 77
    22  UIKit                               0x000e91c4 -[UINavigationController pushViewController:animated:] + 62
    23  Navig                               0x00002dfd -[RootViewController tableView:didSelectRowAtIndexPath:] + 269
    24  UIKit                               0x000a7b68 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
    25  UIKit                               0x0009db05 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
    26  Foundation                          0x007b779e __NSFireDelayedPerform + 441
    27  CoreFoundation                      0x00dbf8c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    28  CoreFoundation                      0x00dc0e74 __CFRunLoopDoTimer + 1220
    29  CoreFoundation                      0x00d1d2c9 __CFRunLoopRun + 1817
    30  CoreFoundation                      0x00d1c840 CFRunLoopRunSpecific + 208
    31  CoreFoundation                      0x00d1c761 CFRunLoopRunInMode + 97
    32  GraphicsServices                    0x010161c4 GSEventRunModal + 217
    33  GraphicsServices                    0x01016289 GSEventRun + 115
    34  UIKit                               0x0003ec93 UIApplicationMain + 1160
    35  Navig                               0x00002439 main + 121
    36  Navig                               0x000023b5 start + 53
)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
Current language:  auto; currently objective-c
(gdb) 
  • 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-26T01:33:54+00:00Added an answer on May 26, 2026 at 1:33 am

    When you say “The above fails.”; how exactly does it fail? Exception raised at run-time, warning during compile, etc? Does this help:

    - (void)giveMeTheNthObj:(id)o {
        if ([o isKindOfClass:[Classname class]]) {
            Classname *local = (Classname *)o;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C can I pass a multidimensional array to a function as a single
Is it possible to pass a reference to a function to another function in
Is it possible to pass a function/callback from javascript to a java applet? For
I am trying to pass a member function within a class to a function
How are pass-by-reference functions typically distinguished from pass-by-value functions? For example: template <typename T>
How do you pass $_POST values to a page using cURL ?
If I pass request fields or cookies with a period/dot in their names, PHP
I would like to pass an argument(s) to a method being defined using define_method,
I need to pass an ID and a password to a batch file at
I'm trying to pass in a Base64 string into a C#.Net web application via

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.