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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:47:16+00:00 2026-05-25T12:47:16+00:00

I have problem in following code. int i = 10; NSString *str; @try {

  • 0

I have problem in following code.

int i = 10;
NSString *str;
@try {
    //Error
    str = [[NSString alloc] initWithFormat:@"%@",i];
    //Warning
    NSLog(@"%i",str);
}
@catch (id exception) {
    NSLog(@"Hello !!!");
}

Please help me out how to handle exception in i/o operation.
Thanks.

Edited by Justin

there’s no suitable place for me to provide this program to you, so i put it here.

try using the following program to reformulate your question:

static void bad_program() {

    @try {
        id array = [NSArray array];
        NSLog(@"will throw...");
        [array stringByAbbreviatingWithTildeInPath];
    }
    @catch (id exception) {
        NSLog(@"\n*** Caught Exception:\n***** Exception Detail: %@\nResolution: Exception swallowed\n", exception);
    }
}

@ Justin, Result of above code
It does not fire exception. It is crashed showing following error.
Sorry Justin, please see if you could help me more. Thanks.

2011-08-25 15:06:48.444 TestError[5120:b303] will throw...
2011-08-25 15:06:48.446 TestError[5120:b303] -[__NSArrayI stringByAbbreviatingWithTildeInPath]: unrecognized selector sent to instance 0x4b38e10
2011-08-25 15:06:48.465 TestError[5120:b303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI stringByAbbreviatingWithTildeInPath]: unrecognized selector  sent to instance 0x4b38e10'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dc05a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f14313 objc_exception_throw + 44
    2   CoreFoundation                      0x00dc20bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x00d31966 ___forwarding___ + 966
    4   CoreFoundation                      0x00d31522 _CF_forwarding_prep_0 + 50
    5   TestError                           0x00002454 -[TestErrorViewController viewDidLoad] + 164
    6   UIKit                               0x000c2089 -[UIViewController view] + 179
    7   UIKit                               0x00035d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
    8   TestError                           0x00002087 -[TestErrorAppDelegate application:didFinishLaunchingWithOptions:] + 135
    9   UIKit                               0x00012c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    10  UIKit                               0x00014d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    11  UIKit                               0x0001f617 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x00017abf -[UIApplication sendEvent:] + 71
    13  UIKit                               0x0001cf2e _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x00ff9992 PurpleEventCallback + 1550
    15  CoreFoundation                      0x00da1944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x00d01cf7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x00cfef83 __CFRunLoopRun + 979
    18  CoreFoundation                      0x00cfe840 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x00cfe761 CFRunLoopRunInMode + 97
    20  UIKit                               0x000147d2 -[UIApplication _run] + 623
    21  UIKit                               0x00020c93 UIApplicationMain + 1160
    22  TestError                           0x00001fc9 main + 121
    23  TestError                           0x00001f45 start + 53
    24  ???                                 0x00000001 0x0 + 1
)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
  • 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-25T12:47:17+00:00Added an answer on May 25, 2026 at 12:47 pm

    I got answer of this question.
    Some exception cannnot catch and some exception will only work for device not on the simulator.

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

Sidebar

Related Questions

I have problem with following code. mySpriteArray=[[NSMutableArray alloc] init]; star=[CCSprite spriteWithFile:@22.png]; for(int i=0;i<10; i++)
I have a problem with the following code. I obtain the error message Exception
Hi I have a problem with the following code: int skp = 1; do{
I have a problem with the following code: #include <stdio.h> #include <iostream> int main
I have a problem compiling the following code: #include <stdio.h> #include <limits.h> int main
I have the following problem: int index=6; imageView.image=[imageArray objectAtIndex:index]; NSLog(@%@,[imageArray objectAtIndex:index]); If I run
I have the following code: NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]; NSString *temp;
I have a problem with the following code: for(i = 0;(i - 1)< n;i++)
I have a problem with the following code: protected void onDraw(Canvas canvas) { Paint
I personally have no problem with the following code if (Object foo != null

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.