App crashes on device, however works fine on Simulator - iphone

My addressbook app works fine on Simulator. I have Contact Add feature.
On device(IOS 6) it get crashed.. with following message.
ContactPro[837] has active assertions beyond permitted time:
{(
<BKProcessAssertion: 0x1f5a28a0> identifier: Suspending process: ContactPro[837] permittedBackgroundDuration: 10.000000 reason: suspend owner pid:52 preventSuspend preventThrottleDownCPU preventThrottleDownUI )}
After that, many lines of information comes like this
Elapsed total CPU time (seconds): 10.030 (user 10.030, system 0.000), 100% CPU
Elapsed application CPU time (seconds): 3.724, 37% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_c.dylib 0x33be8b1e __vfprintf + 158
1 libsystem_c.dylib 0x33b93106 vsnprintf_l + 170
2 libsystem_c.dylib 0x33b9455c snprintf + 68
3 libsystem_c.dylib 0x33b968a6 asl_string_append_char_no_encoding + 102
4 libsystem_c.dylib 0x33b9694c asl_string_append_internal + 124
5 libsystem_c.dylib 0x33b96536 asl_msg_to_string_raw + 118
6 libsystem_c.dylib 0x33b95b06 _asl_send_message + 1018
7 CoreFoundation 0x380d417a __CFLogCString + 602
8 CoreFoundation 0x3807801e _CFLogvEx + 186
9 Foundation 0x3a13ed8a NSLogv + 82
10 Foundation 0x3a13ed2a NSLog + 22
11 ContactPro 0x000a7d38 0xa4000 + 15672
12 ContactPro 0x000a686e 0xa4000 + 10350
13 ContactPro 0x000b9dd0 0xa4000 + 89552
14 UIKit 0x37a6f590 -[UIViewController loadViewIfRequired] + 360
15 UIKit 0x37ac4136 -[UIViewController contentScrollView] + 22
16 UIKit 0x37ac407c -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
17 UIKit 0x37ac3f60 -[UINavigationController _layoutViewController:] + 28
18 UIKit 0x37ac3e84 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 268
19 UIKit 0x37ac35c4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 60
20 UIKit 0x37ac34ac -[UINavigationController _startDeferredTransitionIfNeeded:] + 320
21 UIKit 0x37a944e4 -[UILayoutContainerView layoutSubviews] + 176
22 UIKit 0x37a53806 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 254
23 QuartzCore 0x36145d5e -[CALayer layoutSublayers] + 210
24 QuartzCore 0x361458fc CA::Layer::layout_if_needed(CA::Transaction*) + 456
25 QuartzCore 0x361747a2 -[CALayer layoutIfNeeded] + 138
26 UIKit 0x37afd0cc -[UIViewController window:setupWithInterfaceOrientation:] + 204
27 UIKit 0x37afc2b8 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 3616
28 UIKit 0x37afb48a -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 42
29 UIKit 0x37afb414 -[UIWindow _setRotatableViewOrientation:duration:force:] + 64
30 UIKit 0x37c3117c __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 100
31 UIKit 0x37ab967e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 214
32 UIKit 0x37ab93c0 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 688
33 UIKit 0x37ab8d2e -[UIViewController _tryBecomeRootViewControllerInWindow:] + 154
34 UIKit 0x37aafea6 -[UIWindow addRootViewControllerViewIfPossible] + 366
35 UIKit 0x37aabae8 -[UIWindow _setHidden:forced:] + 360
36 UIKit 0x37aed1cc -[UIWindow makeKeyAndVisible] + 56
37 ContactPro 0x000a5c88 0xa4000 + 7304
38 UIKit 0x37ab0ad4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
39 UIKit 0x37ab065e -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1186
40 UIKit 0x37aa8846 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
41 UIKit 0x37a50c3c -[UIApplication handleEvent:withNewEvent:] + 1000
42 UIKit 0x37a506d0 -[UIApplication sendEvent:] + 68
43 UIKit 0x37a5011e _UIApplicationHandleEvent + 6150
44 GraphicsServices 0x35ce35a0 _PurpleEventCallback + 588
45 CoreFoundation 0x380bb680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
46 CoreFoundation 0x380baee4 __CFRunLoopDoSources0 + 208
47 CoreFoundation 0x380b9cb2 __CFRunLoopRun + 642
48 CoreFoundation 0x3802ceb8 CFRunLoopRunSpecific + 352
49 CoreFoundation 0x3802cd44 CFRunLoopRunInMode + 100
50 UIKit 0x37aa7480 -[UIApplication _run] + 664
51 UIKit 0x37aa42fc UIApplicationMain + 1116
52 ContactPro 0x000a5864 0xa4000 + 6244
53 libdyld.dylib 0x36982b1c start + 0
Can anyone provide some tips as to how to solve it!
For accessing ADDRESS BOOK in IOS6, i am using following lines..
ABAddressBookRef ab = ABAddressBookCreateWithOptions(NULL, NULL);
__block BOOL accessGranted = NO;
if (ABAddressBookRequestAccessWithCompletion != NULL) { // we're on iOS 6
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
ABAddressBookRequestAccessWithCompletion(ab, ^(bool granted, CFErrorRef error) {
accessGranted = granted;
dispatch_semaphore_signal(sema);
});
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
// dispatch_release(sema);
}
else { // we're on iOS 5 or older
accessGranted = YES;
}
if (accessGranted) {
// Do whatever you want here
}
I changed the Addressbook access code,
ABAddressBookRef abcd = ABAddressBookCreateWithOptions(NULL, NULL);
__block BOOL accessGranted = NO;
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(abcd, ^(bool granted, CFErrorRef error) {
// First time access has been granted, add the contact
accessGranted = granted;
});
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) {
// The user has previously given access, add the contact
accessGranted = YES;
}
else {
// The user has previously denied access
// Send an alert telling user to change privacy setting in settings app
}
if (accessGranted) {
CFIndex recordsCount = ABAddressBookGetPersonCount(abcd);
CFArrayRef all = ABAddressBookCopyArrayOfAllPeople(abcd);
ABRecordRef ref = CFArrayGetValueAtIndex(all,recordsCount);
NSLog(#"%#", ref);
ABRecordID record = ABRecordGetRecordID(ref);
}
With this also i am not getting a reference to Contact?.. Also the app getting crashed in both Simulator and Device. However i am getting access to AddressBook. #pls suggest me.. what can be done to solve this issue. Thanks
Thanks & Regards

I think the problem is this: you are using a semaphore to block the thread until "the green light" appears. But you are executing this code on the thread 0 (the main thread, that manages the user interface).
For this reason you are blocking all changes in the user interface, including the alert requesting access to contacts.
EDIT for the new code
First thing: try on a device. For some reason, Simulator always return authorized even if not: ABAddressBookGetAuthorizationStatus in simulator always returns kABAuthorizationStatusAuthorized .
Second thing, your "if (accessGranted)" won't be executed the first time the user authorize the app, because it is executed before the completion block (the completion block waits the user decision), but the code immediately after the block is executed immediately. You should move that code in another function (called after the completion block only once authorized, for example).
But, for testing purpose, this code should work the second time you try to access the AB, once authorized.
Your accessGranted code is fine except one thing: if you have an array of 250 records, you are trying to access the record 250 (that doesn't exists, the last record is number 249).
Change this line
ABRecordRef ref = CFArrayGetValueAtIndex(all,recordsCount);
with this
ABRecordRef ref = CFArrayGetValueAtIndex(all,recordsCount-1);
I tried and it works

Related

reading crash logs itunes after app update

I'v released an update to my app in AppStore, it got accepted pretty quick. Yet, it crashes right after an update. If installed on clean device it works, yet crashes if older version was present... I guess I messed up something and I'm trying to figure out what. I get crash reports from itunes connect, yet they do not tell me quite much. In other crash logs which I'v seen on stackoverflow questions there is Class name, method name and line of crash. While all my crash reports contain only bytes which give me zero information where and what is wrong.
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3231b3e2 __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3a01695e objc_exception_throw + 26
2 CoreFoundation 0x32266ef4 -[__NSArrayM objectAtIndex:] + 160
3 kodinisRaktas 0x000b939a 0x0009f000 + 107418
4 kodinisRaktas 0x000b9282 0x0009f000 + 107138
5 kodinisRaktas 0x000a2434 0x0009f000 + 13364
6 UIKit 0x34149574 -[UIViewController loadViewIfRequired] + 360
7 UIKit 0x3419e1f2 -[UIViewController contentScrollView] + 22
8 UIKit 0x3419e138 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
9 UIKit 0x3419e01c -[UINavigationController _layoutViewController:] + 28
10 UIKit 0x3419df48 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 268
11 UIKit 0x3419d694 -[UINavigationController _startTransition:fromViewController:toViewController:] + 60
12 UIKit 0x3419d57c -[UINavigationController _startDeferredTransitionIfNeeded:] + 320
13 UIKit 0x3416e55c -[UILayoutContainerView layoutSubviews] + 176
14 UIKit 0x3412d8c2 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 254
15 QuartzCore 0x33ed950e -[CALayer layoutSublayers] + 210
16 QuartzCore 0x33ed90b0 CA::Layer::layout_if_needed(CA::Transaction*) + 456
17 QuartzCore 0x33f07eca -[CALayer layoutIfNeeded] + 138
18 UIKit 0x341d70dc -[UIViewController window:setupWithInterfaceOrientation:] + 204
19 UIKit 0x341d62c6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 3598
20 UIKit 0x341d54aa -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 42
21 UIKit 0x341d5434 -[UIWindow _setRotatableViewOrientation:duration:force:] + 64
22 UIKit 0x3430acb4 __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke_0 + 100
23 UIKit 0x3419367e -[UIWindow _updateToInterfaceOrientation:duration:force:] + 214
24 UIKit 0x341933c2 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 690
25 UIKit 0x34192d2a -[UIViewController _tryBecomeRootViewControllerInWindow:] + 150
26 UIKit 0x34189e86 -[UIWindow addRootViewControllerViewIfPossible] + 366
27 UIKit 0x341d4ef2 -[UIWindow setRootViewController:] + 658
28 kodinisRaktas 0x000a1bd4 0x0009f000 + 11220
29 kodinisRaktas 0x000a18f6 0x0009f000 + 10486
30 UIKit 0x3418aa9c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
31 UIKit 0x3418a620 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1164
32 UIKit 0x3418282e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
33 UIKit 0x3412ad1a -[UIApplication handleEvent:withNewEvent:] + 1006
34 UIKit 0x3412a7a8 -[UIApplication sendEvent:] + 68
35 UIKit 0x3412a1ea _UIApplicationHandleEvent + 6194
36 GraphicsServices 0x35e425f2 _PurpleEventCallback + 586
37 GraphicsServices 0x35e42222 PurpleEventCallback + 30
38 CoreFoundation 0x322f03e2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
39 CoreFoundation 0x322f0386 __CFRunLoopDoSource1 + 134
40 CoreFoundation 0x322ef20a __CFRunLoopRun + 1378
41 CoreFoundation 0x32262238 CFRunLoopRunSpecific + 352
42 CoreFoundation 0x322620c4 CFRunLoopRunInMode + 100
43 UIKit 0x34181468 -[UIApplication _run] + 664
44 UIKit 0x3417e2b4 UIApplicationMain + 1116
45 kodinisRaktas 0x000a0d96 0x0009f000 + 7574
46 kodinisRaktas 0x000a0d4c 0x0009f000 + 7500
I can't reproduce the crash on my own device, so this is all I got to determine the crash source. Any ideas ?
You should symbolicate the crash log by opening it in Xcode and clicking Re-symbolicate. If this doesn't work you can do something like this How to Manually Symbolicate iOS Crash to View Crash Logs

FBSession.m Crashes in iOS6.0 with FacebookSdk.framework

I am using new FacebookSdk and My app is crashing when running in iOS 6.0.Here is crash log
*** Assertion failure in -[FBSession close], /Users/jacl/src/release/ios-sdk/src/FBSession.m:404
2012-12-12 12:48:49.993 localfave[1406:1d903] uncaughtExceptionHnadler -- Exception FBSession: should only be used from a single thread
2012-12-12 12:48:49.996 test[1406:1d903] Stack trace: (
0 CoreFoundation 0x02d6b02e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x01cd6e7e objc_exception_throw + 44
2 CoreFoundation 0x02d6ae78 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0176cf35 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 localfave 0x000f6e1d -[FBSession close] + 177
5 localfave 0x000f753e +[FBSession setActiveSession:] + 50
6 localfave 0x000fa6ee +[FBSession openActiveSessionWithPermissions:allowLoginUI:allowSystemAccount:isRead:defaultAudience:completionHandler:] + 230
7 test 0x000f7408 +[FBSession openActiveSessionWithReadPermissions:allowLoginUI:completionHandler:] + 82
8 test 0x00002fc6 -[AppDelegate openSessionWithAllowLoginUI:] + 166
9 test 0x0008adc5 -[FacebookLoginViewController registerFacebook:] + 165
10 libobjc.A.dylib 0x01cea705 -[NSObject performSelector:withObject:withObject:] + 77
11 UIKit 0x00c21920 -[UIApplication sendAction:to:from:forEvent:] + 96
12 UIKit 0x00c218b8 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
13 UIKit 0x00ce2671 -[UIControl sendAction:to:forEvent:] + 66
14 UIKit 0x00ce2bcf -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578
15 UIKit 0x00ce1d38 -[UIControl touchesEnded:withEvent:] + 546
16 UIKit 0x00c5133f -[UIWindow _sendTouchesForEvent:] + 846
17 UIKit 0x00c51552 -[UIWindow sendEvent:] + 273
18 UIKit 0x00c2f3aa -[UIApplication sendEvent:] + 436
19 UIKit 0x00c20cf8 _UIApplicationHandleEvent + 9874
20 GraphicsServices 0x03057df9 _PurpleEventCallback + 339
21 GraphicsServices 0x03057ad0 PurpleEventCallback + 46
22 CoreFoundation 0x02ce0bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
23 CoreFoundation 0x02ce0962 __CFRunLoopDoSource1 + 146
24 CoreFoundation 0x02d11bb6 __CFRunLoopRun + 2118
25 CoreFoundation 0x02d10f44 CFRunLoopRunSpecific + 276
26 CoreFoundation 0x02d10e1b CFRunLoopRunInMode + 123
27 GraphicsServices 0x030567e3 GSEventRunModal + 88
28 GraphicsServices 0x03056668 GSEventRun + 104
29 UIKit 0x00c1e65c UIApplicationMain + 1211
30 test 0x00002545 main + 213
31 test 0x00002425 start + 53
)
And Code is
/*
* Opens a Facebook session and optionally shows the login UX.
*/
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
return [FBSession openActiveSessionWithReadPermissions:nil
allowLoginUI:allowLoginUI
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
[self sessionStateChanged:session
state:state
error:error];
}];
}
/*
* Callback for session changes.
*/
Please Help!
just write this code where you want to post on facebook and discard everyfunction that you have made for facebook integration and i think you have imported #import in .h file.
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultCancelled) {
NSLog(#"ResultCancelled");
} else
{
NSLog(#"Success");
}
[controller dismissViewControllerAnimated:YES completion:Nil];
};
controller.completionHandler =myBlock;
[controller setInitialText:#"Awesome App"];
[controller addImage:photoImage.image];
[self presentViewController:controller animated:YES completion:Nil];
}
let me know it is working or not....!!!
Happy Coding!!!!
Make sure you have Social, Accounts, AdSupport frameworks and they are optional.
Copy FacebookSDK.framework, FacebookSDKResources.bundle, FBUserSettingsViewResources.bundle.
They can be found on Facebook Developers for iOS web page. If the problem occurs again, try deleting all the frameworks and add them again. This is a framework problem, not with the code.

Error when testing application on iPhone, but no error in simulator

I get the below error when I test my application on my iPhone, yet the error doesnt occur in the Simulator. Its when I load up my rootViewController which is a UITableView. I am relatively new to iOS programming, and I was just wondering if anybody could shed any light on it!
Regards,
Michael.
Use this code to go to my RootView.
- (IBAction)goToRootView {
RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:rootViewController animated:YES];
[rootViewController release];
}
2011-09-12 14:39:55.951 LeagueProject[773:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x3684b64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x33aa4c5d objc_exception_throw + 24
2 CoreFoundation 0x367b6069 -[__NSArrayM objectAtIndex:] + 184
3 LeagueProject 0x0000302f -[RootViewController tableView:numberOfRowsInSection:] + 58
4 UIKit 0x356827c7 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1338
5 UIKit 0x356836bb -[UITableViewRowData rectForFooterInSection:] + 66
6 UIKit 0x356835f5 -[UITableViewRowData heightForTable] + 40
7 UIKit 0x35683453 -[UITableView(_UITableViewPrivate) _updateContentSize] + 206
8 UIKit 0x3567ebc9 -[UITableView _rectChangedWithNewSize:oldSize:] + 384
9 UIKit 0x3567d833 -[UITableView setFrame:] + 158
10 UIKit 0x35684e0f -[UIView(Geometry) resizeWithOldSuperviewSize:] + 274
11 UIKit 0x356510bd -[UIView(Geometry) resizeSubviewsWithOldSize:] + 120
12 UIKit 0x356364e9 -[UIView(Geometry) setFrame:] + 336
13 UIKit 0x35688193 -[UIViewControllerWrapperView setFrame:] + 62
14 UIKit 0x35676079 -[UINavigationController _startTransition:fromViewController:toViewController:] + 960
15 UIKit 0x35675c43 -[UINavigationController _startDeferredTransitionIfNeeded] + 182
16 UIKit 0x35667d5d -[UINavigationController pushViewController:transition:forceImmediate:] + 640
17 UIKit 0x35667ad3 -[UINavigationController pushViewController:animated:] + 34
18 LeagueProject 0x0000917d -[splashView goToRootView] + 116
19 CoreFoundation 0x367bb571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
20 UIKit 0x3564dec9 -[UIApplication sendAction:to:from:forEvent:] + 84
21 UIKit 0x3564de69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
22 UIKit 0x3564de3b -[UIControl sendAction:to:forEvent:] + 38
23 UIKit 0x3564db8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
24 UIKit 0x3564e423 -[UIControl touchesEnded:withEvent:] + 342
25 UIKit 0x3564cbf5 -[UIWindow _sendTouchesForEvent:] + 368
26 UIKit 0x3564c56f -[UIWindow sendEvent:] + 262
27 UIKit 0x35635313 -[UIApplication sendEvent:] + 298
28 UIKit 0x35634c53 _UIApplicationHandleEvent + 5090
29 GraphicsServices 0x35f6fe77 PurpleEventCallback + 666
30 CoreFoundation 0x36822a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
31 CoreFoundation 0x3682483f __CFRunLoopDoSource1 + 166
32 CoreFoundation 0x3682560d __CFRunLoopRun + 520
33 CoreFoundation 0x367b5ec3 CFRunLoopRunSpecific + 230
34 CoreFoundation 0x367b5dcb CFRunLoopRunInMode + 58
35 GraphicsServices 0x35f6f41f GSEventRunModal + 114
36 GraphicsServices 0x35f6f4cb GSEventRun + 62
37 UIKit 0x3565fd69 -[UIApplication _run] + 404
38 UIKit 0x3565d807 UIApplicationMain + 670
39 LeagueProject 0x000025a7 main + 82
40 LeagueProject 0x00002550 start + 40
)
terminate called after throwing an instance of 'NSException'
Your error is an index 0 beyond bounds for empty array error. Put breakpoints on the lines where you access arrays. When you find out which array is causing the problem, either the solution will be trivial, or you can add a bit more to your question and ask for further help.
It looks like the problem is in your implementation of [RootViewController tableView:numberOfRowsInSection:]. You are trying to access a member of a NSMutableArray that is empty - hence the error 'index 0 beyond bounds for empty array'.

Unable to trace an error

I'm trying to add an ad package on an app. I've done it on another project, it worked. But here I'm having a mysterious error, that never happened before. Could you help me to trace it ?
Could you help me to trace this error ?
2011-08-29 13:22:12.012 MeoCampus[45962:207] -[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20
2011-08-29 13:22:12.015 MeoCampus[45962:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AdRequest initWithPageId:formatId:master:target:creator:request:requestDelegate:]: unrecognized selector sent to instance 0x633aa20'
*** Call stack at first throw:
(
0 CoreFoundation 0x018925a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x019e6313 objc_exception_throw + 44
2 CoreFoundation 0x018940bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01803966 ___forwarding___ + 966
4 CoreFoundation 0x01803522 _CF_forwarding_prep_0 + 50
5 MeoCampus 0x000a1e92 -[SASApi downloadAdWithFormatId:pageId:master:target:creator:timeout:] + 235
6 MeoCampus 0x000a7a64 -[SmartAdServerView loadFormatId:pageId:master:target:timeout:] + 401
7 MeoCampus 0x000a7ab3 -[SmartAdServerView loadFormatId:pageId:master:target:] + 71
8 MeoCampus 0x00004623 -[HomeViewController viewDidLoad] + 483
9 UIKit 0x00c57089 -[UIViewController view] + 179
10 UIKit 0x00c55482 -[UIViewController contentScrollView] + 42
11 UIKit 0x00c65f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
12 UIKit 0x00c64555 -[UINavigationController _layoutViewController:] + 43
13 UIKit 0x00c65870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
14 UIKit 0x00c6032a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
15 UIKit 0x00d7b2e9 -[UILayoutContainerView layoutSubviews] + 226
16 QuartzCore 0x00203a5a -[CALayer layoutSublayers] + 181
17 QuartzCore 0x00205ddc CALayerLayoutIfNeeded + 220
18 QuartzCore 0x001ab0b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
19 QuartzCore 0x001ac294 _ZN2CA11Transaction6commitEv + 292
20 UIKit 0x00ba99c9 -[UIApplication _reportAppLaunchFinished] + 39
21 UIKit 0x00ba9e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690
22 UIKit 0x00bb4617 -[UIApplication handleEvent:withNewEvent:] + 1533
23 UIKit 0x00bacabf -[UIApplication sendEvent:] + 71
24 UIKit 0x00bb1f2e _UIApplicationHandleEvent + 7576
25 GraphicsServices 0x02199992 PurpleEventCallback + 1550
26 CoreFoundation 0x01873944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
27 CoreFoundation 0x017d3cf7 __CFRunLoopDoSource1 + 215
28 CoreFoundation 0x017d0f83 __CFRunLoopRun + 979
29 CoreFoundation 0x017d0840 CFRunLoopRunSpecific + 208
30 CoreFoundation 0x017d0761 CFRunLoopRunInMode + 97
31 UIKit 0x00ba97d2 -[UIApplication _run] + 623
32 UIKit 0x00bb5c93 UIApplicationMain + 1160
33 MeoCampus 0x000023e9 main + 121
34 MeoCampus 0x00002365 start + 53
)
terminate called after throwing an instance of 'NSException'
Here is the code that create the ad:
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
//Intialize the SmartAdServerView object. This example is for a banner on the iPhone, you can specify any frame you want.
//By convention, banners have a ratio aspect of 6:1 in portrait mode, so if you have borders in your application, you should adapt the ad's height. The creative will be adapted to your view's frame, but it will look better if they have the same size.
//The iPad recommended height, with a 6:1 ratio is 128 pixels
SmartAdServerView *banner = [[SmartAdServerView alloc] initWithFrame:CGRectMake(.0,315.0,320.0,53.0) loader:SmartAdServerViewLoaderActivityIndicatorStyleWhite];
//Set an auto-resizing mask, for the view to adapt it's size when it's superview is resized (after a rotation for example). Typically a banner keep it's height and adapt it's width.
banner.autoresizingMask = UIViewAutoresizingFlexibleWidth;
//Set the banner to stay in place, so it won't be removed automatically.
banner.unlimited = YES;
//Set your ad's delegate, which will be the presentator of ad's modal view to the user, and will be notified of significative events
banner.delegate = self;
NSLog(#"set the delegate.");
NSLog(#"the delegate is = %#", [[banner delegate] class]);
//Load the ad with your settings
//The siteId can be a string in some rare cases, this is why you have to pass an NSString
//One ad per page of your application should have the "YES" for the "master" argument, and the other should have "NO", this is for page view counting.
//[banner loadFormatId:12345 pageId:#"98765" master:YES target:nil];
//Display the ad to the user, here we assume that we are in a UIViewController
[self.view addSubview:banner];
self.myAd = banner;
[banner release];
}
Thanks a lot.
I contacted the ad operator. Thanks you all.
Search for initWithPageId:formatId:master:target:creator:request:requestDelegate: method in your code. You are calling it for an object that does not recognize it.

EXC_BAD_ACCESS (SIGSEGV) and KERN_INVALID_ADDRESS at 0xa0000008

I have a problem that occurs from time to time and I can't find
the solution, can someone help me? Thanks
Here is the log of the crash and where the method is called
0 libobjc.A.dylib 0x00003fb0 objc_msgSend + 16
1 Authentic 0x00048ce2 -[JobsSubtitleView touchUp:] (JobsSubtitleView.m:172)
2 CoreFoundation 0x00026486 -[NSObject performSelector:withObject:withObject:] + 46
3 UIKit 0x00032bf8 -[UIApplication sendAction:to:from:forEvent:] + 56
4 UIKit 0x00032bb4 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24
5 UIKit 0x00032b92 -[UIControl sendAction:to:forEvent:] + 38
6 UIKit 0x00032902 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486
7 UIKit 0x0003307a -[UIControl touchesEnded:withEvent:] + 470
8 UIKit 0x00031914 -[UIWindow _sendTouchesForEvent:] + 312
9 UIKit 0x0003133a -[UIWindow sendEvent:] + 374
10 UIKit 0x000076e6 -[UIApplication sendEvent:] + 350
11 UIKit 0x000070d2 _UIApplicationHandleEvent + 5802
12 GraphicsServices 0x00004f44 PurpleEventCallback + 876
13 CoreFoundation 0x00083a28 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
14 CoreFoundation 0x000839ca __CFRunLoopDoSource1 + 134
15 CoreFoundation 0x000825f0 __CFRunLoopRun + 1364
16 CoreFoundation 0x00023f72 CFRunLoopRunSpecific + 294
17 CoreFoundation 0x00023e3a CFRunLoopRunInMode + 98
18 GraphicsServices 0x0000411e GSEventRunModal + 150
19 UIKit 0x00002472 UIApplicationMain + 1074
20 Authentic 0x0006bbd0 main (main.m:17)
21 Authentic 0x00002e8c start + 32
- (void) touchUp:(id)sender {
if(![[UIApplication sharedApplication] isNetworkActivityIndicatorVisible]) {
UIButton *jobsSubtitleButton = (UIButton*)sender;
[jobsSubtitleButton setSelected:!jobsSubtitleButton.selected];
[jobsViewController setClickType:YES]; /*** LINE 172 ***/
if(![jobsViewController isSearching]) {
[jobsViewController setIsSearching:YES];
if([jobsViewController clickType]) {
[self performSelector:#selector(reloadJobs) withObject:nil afterDelay:1.0f];
} else {
[self performSelector:#selector(reloadJobs) withObject:nil];
}
}
}
}
You have not provided enough code to make the root cause of the problem clear. The crash happens because the jobsViewController ivar in your object points to an object that has already been deallocated. But why was it deallocated at this point? There is no way to know based on this code. The most likely cause is that you forgot to retain it or the property was not declared as "retain". But, there could be a number of programming mistakes that were the root cause. You will need to do a code review looking specifically for problems related to not retaining the object pointed to by jobsViewController.