iPhone iAds: Very inconsistent, sometimes bannerViewDidLoadAd does not get called - iphone

So I show my iAd banners when I get a callback to:
'bannerViewDidLoadAd'
But I've noticed that sometimes this doesn't get called. I have a constant high-speed
internet connection but if I run my app 10 times. 4 of out 10 times it won't show the iAds (i.e., bannerViewDidLoadAd does not get called).
Has anyone else experienced this (and what have you done about this)?

This is by design (I'm assuming you're still running in a dev environment) so that you can test your application when an iAd is available and when an iAd isn't available.
While you are developing your
application, iAd Network sends test
advertisements to your application. To
assist you in validating your
implementation, the iAd Network
occasionally returns errors to test
your error handling code. You can also
test your error handling support by
turning your device’s wireless
capability off.
per Apple's documentation

Related

Where Can I Intercept NSXPCConnectionInterrupted?

OK. I have an app that is in regular communication with a Watch.
They are running apps that can do iOS 10.0 or greater, and WatchOS 3.0 or greater. I don't care about less.
When the iOS app gets shoved into the background, comms to the Watch get interrupted, and I start seeing log entries that mention NSXPCConnectionInterrupted, which is a standard Foundation error.
I have a couple of issues:
1) Where can I intercept this error? It doesn't seem to be showing up in my callbacks or delegate methods.
2) This is not a question. It's just an annoyance. In the simulator, I don't get this. It only happens in the device itself. I didn't encounter it until I was at a point where I could actually install and run on-device.

App crashes in background while bluetooth connection lost for long time

I am developing an app which will communicate with bluetooth low energy devices. And I am displaying the heart rate in UI. It works fine in foreground and background while bluetooth is in connection. But my problem is that while connection of bluetooth device lost longer while app is in background, my app crashed. showing the crash report as :
MyApp[565] has active assertions beyond permitted time:
With Core Bluetooth background communication must be implemented either with characteristic change notifications or indications. You are keeping the app running for too long after being brought to background and iOS is killing it forcefully. I suppose you are using the beginBackgroundTaskWithExpirationHandler: method to keep some timers running. This doesn't work for long periods of time. The limit is around 10 minutes but it may depend on other factors too.
The Core Bluetooth Programming Guide contains a pretty concise description of how backgrounding has to be handled. Practically, your app needs to subscribe on either notifications or indications of the heart rate characteristic and react to it only when the callbacks happen. The app should keep running when backgrounded only if it is doing some uninterruptible task, e.g. non-resumable network operations.
i am assuming that you are on iOS 6.1
Are you handling device disconnect using the following delegate methods of CBCentralManager
– centralManager:didDisconnectPeripheral:error:
– centralManager:didFailToConnectPeripheral:error:
also i suspect there is no device discovery when in background, so you might have to handle that logic in your code

iAd not give any ad [duplicate]

I'm adding iAd to my app. Now, in simulator, it works well but when I load it on a device (v4.1) the ADBannerViewDelegate calls bannerView:didFailToReceiveAdWithError: with this description on the error.userInfo
{
ADInternalErrorCode = 3;
NSLocalizedFailureReason = "Ad inventory unavailable";
}
I think my iAd Network setup is correct. Have I to add an ad by myself or iAd Network automatically sends test ads as in simulator?
EDIT: I think it was a latency problem of the iAd Network server that dispatches the ads. I suppose that when the network had ads for my app it began to work fine.
if you running with a development certificate you will only get test ads even when running on a device. From the iAd Programming Guide:
While you are developing your
application, iAd Network sends test
advertisements to your application. To
assist you in validating your
implementation, the iAd Network
occasionally returns errors to test
your error handling code. You can also
test your error handling support by
turning your device’s wireless
capability off.
So you should see the test Ad on the device but you will never see a real live ad.
Yes, Removing app from device and rebuilding solved it in my case.
It was a latency problem of the iAd Network server that dispatches the ads. I suppose that when the network had ads for my app it began to work fine.
After this did not work for me, deleting the app from the device and doing a clean build did.
Just an additional update, running ad testing on my IPAD I got this error suddently, after banging my head (as others have done) for a while I noticed the time on the IPAD was 8 mins out, both were set on auto but still 8 mins difference, set the IPAD clock manually and error went away!.
Hope this helps someone.
According to the ADBannerView class reference of Apple's documantation iOS Developer Library:
enum {
ADErrorUnknown = 0,
ADErrorServerFailure = 1,
ADErrorLoadingThrottled = 2,
ADErrorInventoryUnavailable = 3,
ADErrorConfigurationError = 4,
ADErrorBannerVisibleWithoutContent = 5,
ADErrorApplicationInactive = 6
};
typedef NSUInteger ADError;
//ADErrorInventoryUnavailable
//Indicates that no advertisements are currently available to download.
//Available in iOS 4.0 and later.
//Declared in ADBannerView.h.
Therefore it is an exception caused by the server side of the iAd; not the code itself.
For the last 5 days I've been having the same issue. I was getting a valid response before that and the bannerViewDidLoadAd delegate method was been called. Maybe there is something on apple's side? I didn't find anything that implies that, but it's my guess

iAd strange console "Unhandled error"

I'm seeing in the console:
"Unhandled error (no delegate or
delegate does not implement
didFailToReceiveAdWithError:):"
Although didFailToReceiveAdWithError is being invoked (I can see that with check points and in the console log)
Does someone has any reasonable explanation? It's like it's working and not working all in the same time. I'm not using IB for the adview, and have added it programmatically and have set the adview.delegate = self. I'm also using three20 in this project if that changes anything.
It's like sometimes he knows who's his delegate and sometime not...
The Apple documentation says:
While you are developing your application, iAd Network sends test advertisements to your application. To assist you in validating your implementation, the iAd Network occasionally returns errors to test your error handling code.
In my app iAd also returns a mix of correct banners, error 3, error 5, ... and so on. Maybe this problem will disappear after the release of the app when iAd changes from
iAd Network serves test ads
to
iAd Network serves live ads if you signed the iAd Network Agreement and enabled advertising for your application

App Suddenly Closes

Fellow developers. My thanks to you all for your help and suggestions.
My app SafetyKnight has been approved for sale by Apple and I have submitted an inApp Purchase version for approval.
One last 'bug.' When first opening my app, it sometimes quits unexpectedly. Not often. But only rarely sometimes.
Does the MKMap or maybe not strong signal from communications provider cause an app to cut out at start-up?
Any thoughts or suggestions of code I might add to NOT have the app close/crash to enhance the user experience?
Check your app's memory usage during launch and initial view display. The app might be running out of memory if a lot of other Apple processes (or background apps) are running (Mail fetch, music player, etc.). Also make sure you are checking all your error and status return values from your networking code.
From the Organizer, you can access crash reports of any device connected to your computer. Make your application run in debug mode on the device until it crashes and check in debugger where it happens.
Did you handle the low memory notifications in the didReceiveMemoryWarning methods of the relevant UIViewControllers? What is the iOS you are building against?