I'm adding Google Admob Fullscreen ads
m_interstitial = [[GADInterstitial alloc] initWithAdUnitID:ADMOB_FS_ID]; // crash here!!!
m_interstitial.delegate = self;
GADRequest* request = [GADRequest request];
request.testDevices = #[ #"XXXXXXXXXXXXXXXXXXXXXXXxxx" ];
[m_interstitial loadRequest:request];
But the app is crash at the init line.
I'm using the Admob ios sdk 7.3.1.
The crash report is below
2015-06-03 00:22:17.077 XXX[17213:4624660] -[GADInterstitialViewController setSlot:]: unrecognized selector sent to instance 0x14e4b6f0
2015-06-03 00:22:17.079 XXX[17213:4624660] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADInterstitialViewController setSlot:]: unrecognized selector sent to instance 0x14e4b6f0'
*** First throw call stack:
(0x29e9a5a7 0x37a80c77 0x29e9fa6d 0x29e9d949 0x29dceb68 0x1dc9f4 0x19b8b4 0xd3923 0xe488d 0x2d3b437b 0x2d418553 0x2d4184dd 0x2d3945e7 0x29e61275 0x29e5e959 0x29e5ed5b 0x29dabb51 0x29dab963 0x312ea1a9 0x2d3fdc91 0x102011 0x38029aaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
Whats the matter?
EDIT: My whole code is below
in AppDelegate.m
- (void)showNag
{
// GAD full
// m_interstitial = [[GADInterstitial alloc] initWithAdUnitID:ADMOB_FS_ID];
m_interstitial = [[GADInterstitial alloc] init];
m_interstitial.adUnitID = ADMOB_FS_ID;
m_interstitial.delegate = self;
GADRequest* request = [GADRequest request];
request.testDevices = #[ #"251a8278d43c4c1468ce2d807a0ccc72" ];
[m_interstitial loadRequest:request];
}
viewcontroller.m
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
AppDelegate* delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
[delegate showNag];
}
I got it. I had the named GADViewController.h/m files. They made conflict with the GAD framework. The framework also has the same named files. I renamed my files and it works now.
Related
error message
2016-03-10 00:54:38.475 GoogleAdTest[2677:1499976]
Google Mobile Ads SDK version: afma-sdk-i-v7.7.0
2016-03-10 00:54:38.475 GoogleAdTest[2677:1499976]
-[UIView setAdUnitID:]: unrecognized selector sent to instance 0x7fbed26188a0
2016-03-10 00:54:38.480 GoogleAdTest[2677:1499976]
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setAdUnitID:]: unrecognized selector sent to instance 0x7fbed26188a0'
code:
NSLog(#"Google Mobile Ads SDK version: %#", [GADRequest sdkVersion]);
// Replace this ad unit ID with your own ad unit ID.
self.bannerView.adUnitID = #"myadmobcode";
self.bannerView.rootViewController = self;
GADRequest *request = [GADRequest request];
request.testDevices = #[
#"2077ef9a63d2b398840261c8221a0c9a" // Eric's iPod Touch
];
[self.bannerView loadRequest:request];
Hope, it will solve your issue. Go to project settings > Build Settings And set -ObjC to Other Linker Flags.
I have two targets in my workspace an iOS App (Bundle id: com.gotit.iphone.gotit, App Group: group.com.gotit.iphone.gotit) and an share extension (Bundle id: group.com.gotit.iphone.gotit.Got-it, App Group: group.com.gotit.iphone.gotit).
I can use my share extension without problem but sometimes (not all the time) when I directly come back to my iOS app I have this error and my app crashes :
Attempted to create a task in a session that has been invalidated
2015-07-22 16:31:21.999 iphone[6095:717111] *** Assertion failure in -[BDBOAuth1SessionManager setDelegate:forTask:], /Users/gautier/Documents/Dev/gotit/iOS/iPhone/trunk/iphone/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m:449
2015-07-22 16:31:22.001 iphone[6095:717111] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: task'
*** First throw call stack:
(0x1865a02d8 0x1982140e4 0x1865a0198 0x187454ed4 0x100547340 0x1005476d8 0x100549190 0x100522084 0x100520a38 0x1000c94a8 0x1000d9f9c 0x1000d9d8c 0x18b02ff08 0x18b1bb2bc 0x18b0cde84 0x18b0cdc50 0x18b0cdbd0 0x18b0156f4 0x18a951db8 0x18a94c820 0x18a94c6c4 0x18a94be58 0x18a94bbd8 0x18a945300 0x1865582a4 0x186555230 0x186555610 0x1864812d4 0x18fedf6fc 0x18b07ef40 0x1000d6fac 0x1988bea08)
libc++abi.dylib: terminating with uncaught exception of type NSException
I use AFNetworking (with BDBOAuth1SessionManager) and this is how I create my networkManager :
+ (instancetype)create {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedClient = [[[self class] alloc] init];
});
return _sharedClient;
}
+ (instancetype)sharedClient {
if (!_sharedClient) {
[GotItClient create];
}
return _sharedClient;
}
- (id)init {
self = [super init];
if (self) {
NSURL *baseURL = [NSURL URLWithString:kSCGotItClientAPIURL];
NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:#"group.com.gotit.iphone.gotit"];
sessionConfiguration.sharedContainerIdentifier = #"group.com.gotit.iphone.gotit";
_networkManager = [[BDBOAuth1SessionManager alloc]
initWithBaseURL:baseURL
sessionConfiguration:sessionConfiguration
consumerKey:kSCGotItClientKey
consumerSecret:kSCGotItClientSecret
shareDefaultGroupId:#"group.com.gotit.iphone.gotit"];
_networkManager.responseSerializer = [[AFJSONResponseSerializer alloc] init];
//4 operations at same time
[[_networkManager operationQueue] setMaxConcurrentOperationCount:20];
}
return self;
}
Tell me if you need more code
I have an application that is using the MultiPeer Connectivity framework. Every time the application becomes active in AppDelegate, I make a new MCSession a MCNearbyBrowserService, and a MCNearbyAdvertiserService and call start browsing and start advertising. Then every time the application becomes inactive in AppDelegate, I stop browsing and advertising and set everything to nil. I find that MCNearbyBrowserService causes a crash in its syncQueue:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** - [__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]'
*** First throw call stack:
(0x2de3ee8b 0x381396c7 0x2dd7caef 0x2dd7c8b3 0x2f648167 0x2f6493af 0x3861e103 0x38622e77 0x3861ff9b 0x38623751 0x386239d1 0x3874ddff 0x3874dcc4)
libc++abi.dylib: terminating with uncaught exception of type NSException
sometimes when the app reopens.
Here is my code for applicationDidBecomeActive:
self.myIdentifier = [[MCPeerID alloc] initWithDisplayName:[self.class createHash:20]];
self.mainSession = [[MCSession alloc] initWithPeer:self.myIdentifier];
self.mainSession.delegate = self;
peerAdvertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:self.myIdentifier discoveryInfo:nil serviceType: service];
peerAdvertiser.delegate = self;
peerBrowser = [[MCNearbyServiceBrowser alloc] initWithPeer:self.myIdentifier serviceType: service];
peerBrowser.delegate = self;
acceptReset = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:#selector(reset) userInfo:nil repeats:YES];
acceptPosts = true;
[peerBrowser startBrowsingForPeers];
[peerAdvertiser startAdvertisingPeer];
self.isBrowsing = true;
and here is my code for applicationWillResignActive:
[acceptReset invalidate];
[peerAdvertiser stopAdvertisingPeer];
[peerBrowser stopBrowsingForPeers];
[self.mainSession disconnect];
self.mainSession = false;
self.isBrowsing = false;
The full code can be viewed here: http://pastebin.com/E3wY6U4N
I remember running into this issue, and the quick fix was to nil out the delegates and release the browser and advertiser. So assuming your App Delegate has a strong property for each the setup method would look like:
self.peerAdvertiser = [[MCNearbyServiceAdvertiser alloc] initWithPeer:self.myIdentifier discoveryInfo:nil serviceType: service];
self.peerAdvertiser.delegate = self;
self.peerBrowser = [[MCNearbyServiceBrowser alloc] initWithPeer:self.myIdentifier serviceType: service];
self.peerBrowser.delegate = self;
And then when the app enters the background (or otherwise wants to stop browsing/advertising):
self.peerAdvertiser.delegate = nil;
[self.peerAdvertiser stopAdvertisingPeer];
self.peerAdvertiser = nil;
self.peerBrowser.delegate = nil;
[self.peerBrowser stopBrowsingForPeers];
self.peerBrowser = nil;
[self.mainSession disconnect];
I'd also recommend against creating a new MCPeerID on each app launch, as Multipeer Connectivity has a habit of discovering old peers, and you'll end up discovering your 'former self' on each relaunch.
I am using BlackRaccoon to download a file from FTP server. Following is the code:
- (IBAction)download:(id)sender {
downloadData = [NSMutableData dataWithCapacity: 1];
downloadFile = [[BRRequestDownload alloc] initWithDelegate: self];
downloadFile.path = #"psnewsletter.pdf";
downloadFile.hostname = #"server";
downloadFile.username = #"user";
downloadFile.password = #"pswd";
[downloadFile start];
}
Its gives following error
2014-02-20 11:48:43.526 BlackHillPrimarySchool[2036:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainViewController requestFailed:]: unrecognized selector sent to instance 0xcd609f0'
Any help will be appreciated.
requestFailed: is one of the BRRequest delegate method that you must implement in your view controller.
- (void)requestFailed:(BRRequest *)request {
BRRequestError *reqError = request.error;
// check the error, handle as needed.
}
I'm not sure how your code even compiled. This is a required method of the protocol.
Request:
- (void) getMyImageWithContestOfFace{
currentApiCall = getMyImageFb;
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"SELECT pic FROM user WHERE uid=me()",#"query",
nil];
AppDelegate *delegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
[[delegate facebook] requestWithMethodName:#"fql.query"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
Parsing:
...
case getMyImageFb:{
flag = TRUE;
imageWithFace = [[UIImage alloc] init];
imageWithFace = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[result objectForKey:#"pic"]]]];
}
break;
...
When i call it i catch very strange exeption:
*2011-11-10 00:30:30.661 FaceGraph[1699:f803] I have some information
2011-11-10 00:30:30.664 FaceGraph[1699:f803] -[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x6d3d470
2011-11-10 00:30:30.666 FaceGraph[1699:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x6d3d470'
First throw call stack:
(0x15d9052 0x176ad0a 0x15daced 0x153ff00 0x153fce2 0x254db 0xb6d6 0xbcf7 0xc9ba59 0xc99e94 0xc9aeb7 0xc99e4f 0xc99fd5 0xbdef6a 0x3b8bbbd 0x3c585ea 0x3b82298 0x3c5816b 0x3b82137 0x15ad97f 0x1510b73 0x1510454 0x150fdb4 0x150fccb 0x14c2879 0x14c293e 0x2a6a9b 0x2332 0x22a5)
terminate called throwing an exceptionsharedlibrary apply-load-rules all
Current language: auto; currently objective-c
No idea why. The most strange that i did it before ABSOLUTELY the same, and it worked fine.
I can't find the difference between my old projects and current. Maybe somebody have the same problem?? If you need more code - ask for it.
thanks
Well, the exception seems to be quite clear: result is probably an array and not a dictionary.
PS: The line imageWithFace = [[UIImage alloc] init]; is totally superfluous given the line that follows it. You should remove it.
I forgot to add:
if ([result isKindOfClass:[NSArray class]]){
result = [result objectAtIndex:0];
}
in result-parsing function.