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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:30:55+00:00 2026-06-06T17:30:55+00:00

I’ve copied all my category files & header includes to the new Xcode project,

  • 0

I’ve copied all my category files & header includes to the new Xcode project, and pasted a section of code that was in the DataViewControler to one of the Tab’s view controllers (SecondViewController); both inside the viewDidLoad() section.

Here’s a snippet of the copy & pasted code:

SecondViewController.m

#import "SystemStatusReportSecondViewController.h"
#import "memAndProcesses1.h"
#include <stddef.h>
#import "NSObject+BatteryStats.h"
#import "NSObject+DeviceInfo.h"
#import "IPAddress.h"

@interface SystemStatusReportSecondViewController ()

@end

@implementation SystemStatusReportSecondViewController
@synthesize batteryTextView;

- (void)viewDidLoad
{
    [super viewDidLoad];

NSObject *myObject = [[NSObject alloc] init];
[myObject autorelease];
UIDevice *device = [UIDevice currentDevice];

//...

NSString *batteryStatus = [myObject simpleBatteryStatus];

}

BatteryStats.m

#import "NSObject+BatteryStats.h"

 @implementation NSObject (BatteryStats) 

- (float)batteryLevel {
    UIDevice *myDevice = [UIDevice currentDevice];
    [myDevice setBatteryMonitoringEnabled:YES];
    float batteryLevel = [myDevice batteryLevel]; 

    return batteryLevel;
}

- (NSString*)simpleBatteryStatus {

    NSArray *batteryStatus = [NSArray arrayWithObjects: 
                              @"Battery status is unknown.", 
                              @"Battery is in use (discharging).", 
                              @"Battery is charging.", 
                              @"Battery is fully charged.", nil];
    int batteryState = [[UIDevice currentDevice] batteryState];
    NSString *batteryChargeStr = [batteryStatus objectAtIndex:batteryState];


    return batteryChargeStr;
}

@end

Whenever I try to call a category function with myObject the app crashes on the page that contains that code (in this case, when I switch to the tab with battery information).

There are otherwise no warnings or errors, it just crashes.

Below is the log. Has anyone experienced something like this before? It’s possible I had updated some setting in the original early in the process that affects this stuff and then I just forgot about it.

2012-06-28 13:31:53.965 SystemStatusReport[8269:f803] -[NSObject simpleBatteryStatus]: unrecognized selector sent to instance 0x6840440
2012-06-28 13:31:54.025 SystemStatusReport[8269:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSObject simpleBatteryStatus]: unrecognized selector sent to instance 0x6840440'
*** First throw call stack:
(0x13c8022 0x1559cd6 0x13c9cbd 0x132eed0 0x132ecb2 0x301b 0xd9a1e 0xf50a9 0xf4edd 0xf34aa 0xf334f 0xf4e14 0x13c9e99 0x1514e 0x150e6 0x23d4bd 0x13c9e99 0x1514e 0x150e6 0xbbade 0xbbfa7 0xbbb13 0x23fc48 0x13c9e99 0x1514e 0x150e6 0xbbade 0xbbfa7 0xbb266 0x3a3c0 0x3a5e6 0x20dc4 0x14634 0x12b2ef5 0x139c195 0x1300ff2 0x12ff8da 0x12fed84 0x12fec9b 0x12b17d8 0x12b188a 0x12626 0x2a12 0x2985 0x1)
terminate called throwing an exception(lldb) 
  • 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-06T17:30:55+00:00Added an answer on June 6, 2026 at 5:30 pm

    There are 2 possibilities:

    1. You didn’t #include BatteryStats.h in your SecondViewController.m, or
    2. You don’t have -simpleBatteryStatus method in your category there’s only one method in the code you posted, the -batteryLevel

    Tip: If you want your categories to be loaded automatically, add -ObjC flag to your target                             (in Target > Build Settings > Other Linker Flags).

    -ObjC Loads all members of static archive libraries that implement an Objective-C class or category.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.