App Crash on Working with Facebook Connect - objective-c

While I'm testing my app, is an UITableViewController navigation based app, sometimes, getting back or changing the view for another, I'm getting the next crash message. I can't solve this error, I don't know what is the responsible of this. Somebody can help me?
Thanks for reading.
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
When the app has finish, XCode points this Facebook Connect method.
- (void)dialogDidSucceed:(NSURL *)url {
if ([_delegate respondsToSelector:#selector(dialogCompleteWithUrl:)]) {
[_delegate dialogCompleteWithUrl:url];
}
[self dismissWithSuccess:YES animated:YES];
}

Now the problem is solved. The best way to use the Facebook Connect SDK is to implement all the Facebook related objects into the App Delegate. When the user touch the button that allow to post into him Facebook wall (doesn't matter the UIView where the user is), you only have to call the App Delegate and get the Facebook objects that you need to call the Facebook Connect dialog. The App Delegate must be the Facebook Connect delegate for FBDialogDelegate and for FBSessionDelegate. Also, the App Delegate must implement the application: handleOpenURL: method.
Thanks to everyone for reading.

Related

ios7 Getting Delegate for canDisplayBannerAds

I am integrating iAd with AdMob. I want to call AdMob when iAd fails to deliver an ad. The problem I am encountering is that the basic canDisplayBannerAds = YES does not fire a delegate method when ads fail to load. If I were actually creating a banner ad I could set that delegate to self. However, here since all we have to do is call self.canDisplayBannerAds = YES; I don't understand where to set the delegate. The method for failure is:
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
However, the above is not called when iAd cannot deliver (I have the simulator set to always fail). I do have ADBannerViewDelegate set in the interface.
Do I need to actually create a banner myself to get access to this delegate and method or is there someway to get the delegate working here so that I can use the above method?
I don't know if this is what you're looking for, but at a certain point in your app you can check your view controller's displayingBannerAd boolean to see if an iAd is currently being displayed. If not, show your AdMob ads...

iAd interstitial delegate methods doesn't get called

I want to use interstitial ads in my app, so I implemented all necessary delegate methods.
The problem is, if I use [self requestInterstitialAdPresentation] to show the ad, only the interstitialAdDidLoad: method gets called.
The interstitialAdActionDidFinish: methods doesn't get called...
But if I use the deprecated [self.interstitial presentFromViewController:self] to show the ad, everything works.
Is there anything new to implement to get things work ?
Thanks in advance
Ok, I resolved the problem.
Since IOS7 with its iAd Additions there's no need for an adInterstitialDelegate. The only thing to do, is preparing the ads or set the interstitialPresentationPolicy to something other than none (as you can read in the documentation) and as a last step requesting the ad using the requestInterstitialAdPresentation: method.
iOS 9.2.1, Xcode 7.2.1, ARC enabled
#Jellyjoey I confirmed, viewDidAppear is called when the ad is closed. And as you might expect, when you tap the ad, viewDidDisappear gets called.
It has to do with how you are presenting the interstitial ad:
Completing an Advertising Action
If the full-screen ad displayed the rich media ad inside your app, it
calls your delegate’s interstitialAdActionDidFinish: method after the
ad finishes. Your implementation of this method should restore any
services paused by your app when the action started.
Important: If your app was moved into the background because the
willLeave parameter was YES, then the app’s user interface is never
covered by the banner view and your app does not receive a call to
interstitialAdActionDidFinish:. However, if your interface was covered
by the banner view, your app could still be moved into the background
later, either because the advertisement launched another app or
because the user chose to do so. In all cases, if your user interface
was covered by the banner view, it is uncovered and your delegate’s
interstitialAdActionDidFinish: is invoked before your app moves to the
background. Because the app may be moving into the background, your
delegate should return quickly from its interstitialAdActionDidFinish:
method.
To view the excerpt above and the rest of the guidelines for interstitial ads:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/iAd_Guide/Full-ScreenAdvertisements/Full-ScreenAdvertisements.html#//apple_ref/doc/uid/TP40009881-CH5-SW24
Here are two examples provided by Apple of how to use full page ads:
https://developer.apple.com/library/ios/samplecode/iAdInterstitialSuite/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010627-Intro-DontLinkElementID_2

iOS App - Refresh last webView on applicationDidBecomeActive

I have a single view iOS app, that contains a webView that displays my website. When the app is returned to from multitasking (when it is brought back as the active app) I would like the webView to get the URL it is currently on, and refresh (or reload) that current page in the webView (I'm thinking using this method):
- (void)applicationDidBecomeActive:(UIApplication *)application
{
NSLog(#"applicationDidBecomeActive");
}
How would I do this? Do I need to subscribe to some sort of notification? Please help point me in the right direction, and provide some code.
There are some point to get noticed are like:
Application should allow user to run in background mode. You can define this in info.plist
Implement UIWebViewDelegate in your view controller. There is one method: webViewDidStartLoad:
Inside that method get the current url
NSString *currentURL = [webView stringByEvaluatingJavaScriptFromString:#"window.location"];
(For more details refer this.)
Save this url string to some where, and while relaunching your application the method which you mentioned in the question gets called. Inside that method, load your web view with this url string.
Hope this is what you required.
Enjoy coding :)

Application crashes while logging out in iPAD

My question is specific to iPAD, and I also aware of the basic memory management of iOS, but I am having a different problem.
As I have build an application where I have several UIViewControllers and UIViews,
I have a loginController thats gets called when I launch the App.
My MainView is a single screen with all the ViewController loaded and placed at their respective places and the app runs fine and smoothly.
Problem:
Problem comes when I logout, most of the time my App crashes by saying EXC_BAD on the
[super dealloc] line of my mainView controller.
As for now on I have added a custom function cleanUP in all my viewControllers that gets called when user logout from the app.
Is this the right approach ?
As I know that we can clean up in our didload etc. function and the dealloc gets called too.
but here i have an iPAD when my all viewControllers are just open in front of me, They will be closed or not visible when I logout from the App.
So how to approach on my crash issue and How to manage memory here in my iPAD?
The best way I know to resolve bad-access problems is to use Instruments with the Zombie tool. As you probably know, when you get a bad access issue, is because you try to access to an object that is deallocated.
Try go to Product -> Profile and choose Zombie. Hit record and reproduce your crash. then inspect the pointer to the object that produced that crash and look for the retain count.

how to handle “sendDidFinish” in sharekit

I use sharekit with mail/twitter/facebook and I am really new to objective-c. sharekit works well and sends my images like it should.
in my app I have a screenshot function. I want the app to 'freeze' when a screenshot is taken, stopping to send any shake- or touch-event to the scene behind the sharekit-action.
in my screenshot-layer I have three buttons which call the shareItem-methods of their specified service, like
[SHKTwitter shareItem:item];
vereything works fine 'till here. but now when the sending is finished (or canceled or errored) I need the app to 'unfreeze', sharekit should tell my app that it is allowed to listen to any touch- or shake-action again.
I am sorry but I think I don't understand the concept of using the delegate here. I mean, is 'sendDidFinish' meant to be inside a delegate? and if so, how could I tell sharekit who is its delegate? or do I have to edit the send-service classes (like SHKItem or SHKFacebook) itself?
please don't downrate me for this question. I really want to get behind this mystery...
SHKTwitter inherit from SHKOAuthSharer, who inherit from SHKSharer. SHKSharer has a delegate protocol called "SharerDelegate".
So you can use an instance of SHKTwitter, then set it's delegate as :
shkTwitterInstance.shareDelegate = yourDelegateObject.
And implement the delegate method
- (void)sharerFinishedSending:(SHKSharer *)sharer;.
Try that.
EDIT (OTHER, AND MORE POPULAR, SOLUTION)
Also, you can suscribe your object to "SHKSendDidFinish" notification from SHKTwitter object.
[[NSNotificationCenter defaultCenter] addObserver:yourObject selector:#selector(theMethodthatYouWantToExecuteWhenTheNotificationIsRaised:) name:#"SHKSendDidFinish" object:shkTwitterObject];