how to respond to revmob sdk uialertview delegate? - ios

Im trying to implement revmob sdk,
it works fine but their documentation dont have much detail and support not responding.
(http://sdk.revmob.com/sdks/ios/docs/index.html)
is there a way to use the delegate to know the status of the alertbox ?
this is what I currently use to call:
[BCFAds showPopupWithAppID:#"appId" withDelegate:nil];

after starting to ask the question I found the answer,
so incase someone else have this problem here is the solution.
to your .h file add a delegate called BCFAdsDelegate.
add #import "BCFAds.h"
in the .m file where you call the sdk add
[BCFAds showPopupWithAppID:#"appId" withDelegate:self];
use the method you want:
- (void)popupDidDismissActive;
// Called when user is back to the app
- (void)popupDidReceive;
// Called when a popup is available
- (void)popupDidFail;
// Called when a popup is not available
- (void)popupDidBecomeActive;
// Called when popup is displayed
- (void)popupDidDismissActive;
// Called when user is back to the app
- (void)userWillLeaveApplication;
// Called when user clicked and is about to leave the application

Related

How to go to specific native view controller from react-native code?

I'm a newbie in react-native. I'm adding one feature in react-native to an existing swift application. I presented the RCTRootview from my native view controller. From there when user clicks on back button I have to go to Homepage which is written in swift. How do I communicate from react-native to native application code. Can someone please help me with this scenerio. I stuck at this point from last 2 days. Thanks in advance.
Yes. I found out the answer for this. It is all possible with RCTBridgeModule. This piece of code illustrate how to do that.
#import "CalendarManager.h"
#import <React/RCTLog.h>
#implementation CalendarManager
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location)
{
RCTLogInfo(#"Pretending to create an event %# at %#", name, location);
}
Now, from your JavaScript file you can call the method like this:
import {NativeModules} from 'react-native';
var CalendarManager = NativeModules.CalendarManager;
CalendarManager.addEvent('Birthday Party', '4 Privet Drive, Surrey');
Please follow the below official link about the concept and how to do it.

How to call methods in the custom view in iOS module, from titanium project?

I need to call methods in the custom view in iOS module from titanium project. I have followed the tutorials in Appcelarator documentation about creating iOS module. I could create the custom view in Titanium using below code.
var manage = require('com.test');
var manageView = manage.createView({
left:40,
right:40,
top:40,
height: 250,
backgroundColor:'blue' }); manageView.customMethodInView();
But i got error like "customMethodInView is not a function" when i run the app.
#import "TiViewProxy.h"
#import "CustomView.h"
#interface ComTestViewProxy : TiViewProxy {
CustomView *customView;
}
- (void) customMethodInView;
#end
This is the code in viewProxy class in iOS Module project.
Please help.
I know this is late, but for any wondering soul out there, it is my understanding that even if you don't intend to pass an argument for your method, the signature of the method in the native module should always take one:
your method
- (void) customMethodInView;
should look like this :
- (void)customMethodInView:(id)unused;

iOS - How does Cordova invoke objective c function?

How does cordova trigger objective-c native method. For example- When a user taps on submit button (html button), app needs to invoke native objective c function called 'dataSubmitted'.
Does Cordova monitor webview navigation and based on URL tags call method internally?
Is there any way JavaScript can interact with Obj-c native methods except monitoring webview navigations?
There are two ways to communicate with native language from JS.
1. Go to MainViewController.m -> find a function named webViewDidFinishLoad
and add the follwing code snippet..
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
NSString *pageUrl = [theWebView.request.URL absoluteString];
if ([pageUrl containsString:#"xyz"]) {
// xyz for xyz.html
}else if ([pageUrl containsString:#"abc"]) {
// abc for abc.html
}
self.webView = theWebView;
return [super webViewDidFinishLoad:theWebView];
}
Develop your own native plugin with cordova.exec ;
There are a few libraries available to communicate between Javascript and Objective-C it seems:
WebViewJavascriptBridge: https://github.com/marcuswestin/WebViewJavascriptBridge
GAJavaScript: https://github.com/newyankeecodeshop/GAJavaScript
I suggest you to check out this beautiful SO Post which explains Javascript & Objective-C interactions in detail.

iOS Nextpeer facebook integration issue

I am trying to integrate Facebook with Nextpeer. When i tell nextpeer about successful login by these methods:
[Nextpeer loginWithFacebook];
[Nextpeer logoutFromFacebook];
I gives me warning on console
Nextpeer warning: Couldn't login Facebook user - no instance of NPFacebookBridgeDelegate provided.
I have also provided implementation for delegate methods of NPFacebookBridgeDelegate which are:
-(NPFacebookSession*) getCurrentFacebookSession;
-(void) destroyCurrentFacebookSession;
-(void) requestFacebookSessionWithPermissions:(NSArray*)permissions completionBlock:(void (^)(NPFacebookSession* session))completionBlock;
-(void) requestFacebookPermissions:(NSArray*)permissions completionBlock:(void (^)(NPFacebookSession* session))completionBlock;
but these never gets called. Anyone have any idea what am I missing?
Thanks
You missed passing the NextpeerFacebookBridgeDelegate in the initializion phase, as the log said.
Read more here https://nextpeer.atlassian.net/wiki/display/NS/Facebook+Integration
Thanks.. I did it by changing init of nextpeer from
[Nextpeer initWithProductKey:];
To this:
[Nextpeer initializeWithProductKey:GAME_KEY andDelegates:[NPDelegatesContainer containerWithNextpeerDelegate:self tournamentDelegate:self facebookBridgeDelegate:self] ];

Method not implemented in protocol (using wit.ai SDK)

I'm using the wit.ai iOS SDK for the first time and I followed step by step what is written in the getting started page in official website https://wit.ai/docs/ios/3.1.1/quickstart. I got this error:
Method 'witDidGraspIntent:entities:body:error:' in protocol 'WitDelegate' not implemented.
I could still run the app and the message is shown in my inbox (in console) but not response is being sent back and the application crashes. I got this error:
Error when enqueuing buffer from callback
Here is my code
ViewController.m
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController {
UILabel *labelView;
}
- (void)witDidGraspIntent:(NSArray *)outcomes
messageId:(NSString *)messageId
customData:(id)customData
error:(NSError*)e {
//Implementation here...
labelView.text = #"Hey what's up";
[self.view addSubview:labelView];
}
ViewController.h
#import <UIKit/UIKit.h>
#import <Wit/Wit.h>
#interface ViewController : UIViewController <WitDelegate>
#end
Thanks.
Dude, the crash message you are getting is telling you exactly what is wrong.
Method 'witDidGraspIntent:entities:body:error:' in protocol
'WitDelegate' not implemented.
You are missing a method (witDidGraspIntent:entities:body:error:) in your implementation of the protocol. You must implement all the required methods in a protocol. In this case the missing method is witDidGraspIntent:entities:body:error:.
You ask "Should I add a new -void ??" By that, if you mean should you add an implementation of the witDidGraspIntent:entities:body:error: method, the answer is YES!
I haven't used the wit.ai SDK before. You might want to edit your question and ask people who have used that SDK for help in implementing the method if you can't figure out how to do it on your own. You might also want to add "(using wit.ai SDK)" to your question title so people familiar with that framework notice your question.

Resources