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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:38:54+00:00 2026-05-30T20:38:54+00:00

When i use @try @catch, i get error: expected identifier or ‘(‘ before ‘try’

  • 0

When i use @try @catch, i get error: expected identifier or ‘(‘ before ‘try’ objective-c

@implementation BannerView
 @synthesize timer;

@synthesize _responceInfo;
@synthesize recivedData;

@try {
NSString* const _mainUrl = 
@"http://www.admobilapp.com/view.php?place_id=15&country_id=112&sex=3&rand=0.7858213884755969&gsmOperator=";
}
@catch (NSException * e) {
    NSLog(@"Exception: %@", e);
}
@finally {
    NSLog(@"finally");
}

NSString*const _ImagePath= @"\"image\":";
NSString*const _ImageClickUrl= @"\"link\":";
NSString*const _imagerotation = @"\"rotation\":";

How to fix it?

error: expected identifier or ‘(‘ before ‘try’ objective-c, fixed, but now if i run application i have another error,
And app is crash.

2012-02-27 00:28:02.794 Clicky[8409:9203] finally
2012-02-27 00:28:02.818 Clicky[8409:9203] * Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘ -[NSCFString substringFromIndex:]: Range or index out of bounds’
*
* Call stack at first throw:
(
0 CoreFoundation 0x00db1be9 exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f065c2 objc_exception_throw + 47
2 CoreFoundation 0x00d6a628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d6a59a +[NSException raise:format:] + 58
4 Foundation 0x000250de -[NSString substringFromIndex:] + 133
5 Clicky 0x00003232 -[BannerView ExtractStringKeyValue:] + 123
6 Clicky 0x000031b1 -[BannerView ExtractImageUrl] + 48
7 Clicky 0x00003739 -[BannerView Refresh] + 59
8 Clicky 0x00003805 -[BannerView initWithFrame:] + 157
9 UIKit 0x0049fce5 +[UIButton buttonWithType:] + 1373
10 Clicky 0x00002e6a -[Examples viewDidLoad] + 51
11 UIKit 0x0036865e -[UIViewController view] + 179
12 UIKit 0x0037b230 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
13 UIKit 0x00379d86 -[UITabBarController transitionFromViewController:toViewController:] + 64
14 UIKit 0x0037bb7e -[UITabBarController _setSelectedViewController:] + 263
15 UIKit 0x0037b9ed -[UITabBarController _tabBarItemClicked:] + 352
16 UIKit 0x002baa6e -[UIApplication sendAction:to:from:forEvent:] + 119
17 UIKit 0x004b81f2 -[UITabBar _sendAction:withEvent:] + 422
18 UIKit 0x002baa6e -[UIApplication sendAction:to:from:forEvent:] + 119
19 UIKit 0x003491b5 -[UIControl sendAction:to:forEvent:] + 67
20 UIKit 0x0034b647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
21 UIKit 0x0034916c -[UIControl sendActionsForControlEvents:] + 49
22 UIKit 0x002baa6e -[UIApplication sendAction:to:from:forEvent:] + 119
23 UIKit 0x003491b5 -[UIControl sendAction:to:forEvent:] + 67
24 UIKit 0x0034b647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
25 UIKit 0x0034a1f4 -[UIControl touchesEnded:withEvent:] + 458
26 UIKit 0x002df0d1 -[UIWindow _sendTouchesForEvent:] + 567
27 UIKit 0x002c037a -[UIApplication sendEvent:] + 447
28 UIKit 0x002c5732 _UIApplicationHandleEvent + 7576
29 GraphicsServices 0x016e7a36 PurpleEventCallback + 1550
30 CoreFoundation 0x00d93064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION
+ 52
31 CoreFoundation 0x00cf36f7 __CFRunLoopDoSource1 + 215
32 CoreFoundation 0x00cf0983 __CFRunLoopRun + 979
33 CoreFoundation 0x00cf0240 CFRunLoopRunSpecific + 208
34 CoreFoundation 0x00cf0161 CFRunLoopRunInMode + 97
35 GraphicsServices 0x016e6268 GSEventRunModal + 217
36 GraphicsServices 0x016e632d GSEventRun + 115
37 UIKit 0x002c942e UIApplicationMain + 1160
38 Clicky 0x00002840 main + 102
39 Clicky 0x000027d1 start + 53
)
terminate called throwing an exception

@try @catch doesn’t work. :(.

  • 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-30T20:38:55+00:00Added an answer on May 30, 2026 at 8:38 pm

    You cannot use @try/@catch/@finally outside a method body. Assigning a static string cannot fail anyway.

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

Sidebar

Related Questions

Is it possible to use TRY CATCH blocks in SQL Selects? For stuff similar
so in my program I have parts where I use try catch blocks like
Is it better, less expensive or more readable to use a try/catch block in
This article on MSDN states that you can use as many try catch blocks
I am trying to catch 'Trying to get property of non-object' error with a
I have some code like: try: do_the_first_part() except SomeError: do_the_next_part() I get an error
I get a SocketException: Bad file number whenever I try to use a BufferedReader
Consider this try / except block I use for checking error message stored in
I try to use this code for toggling text on the link: var showText=<span>Open</span>
I try to use the domainpeople.com API and to do I need to use

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.