objective c - ObjectiveC framework in Swift app causing errors (MobFox ad network framework) -


i'm trying implement mobfox ad network swift app. framework built in objc i'm not familiar with.

i have added bridging header.

im getting 2 errors cannot figure out. code producing errors:

class viewcontroller: uiviewcontroller, mobfoxnativeaddelegate {  ...      func nativeadfailedtoloadwitherror(error: nserror!) {     }      func nativeadwasclicked() {     }      func nativeadwasshown() {     }      func publisheridformobfoxnativeadcontroller(controller: mobfoxnativeadcontroller!) -> string! {     return "publisher_id_here"     }      func nativeaddidload(ad: mobfoxnativead!) {     } } 

these issues:

class viewcontroller: uiviewcontroller, mobfoxnativeaddelegate { 

the above code causes error: type 'viewcontroller' cannot conform protocol 'mobfoxnativeaddelegate' because has requirements cannot satisfied

i'm sure there no other methods need implement - unless im mistaken.

the other issue is:

func nativeaddidload(ad: mobfoxnativead!) { } 

on line following error: use of undeclared type 'mobfoxnativead'

the strange thing xcode doesn't suggest method when typing, seems invalid. example if type native, xcode suggests nativeadfailedtoloadwitherror, nativeadwasclicked , nativeadwasshown - not suggest nativeaddidload.

however, required method.

looking @ objc framework contains:

@class mobfoxnativeadcontroller; @class mobfoxnativead;  @protocol mobfoxnativeaddelegate <nsobject>  - (nsstring *)publisheridformobfoxnativeadcontroller:(mobfoxnativeadcontroller *)controller;  - (void) nativeaddidload:(mobfoxnativead *)ad;  - (void) nativeadfailedtoloadwitherror:(nserror *)error;  - (void) nativeadwasshown;  - (void) nativeadwasclicked;  - (uiviewcontroller*) viewcontrollerfornativeads;  @end  @interface mobfoxnativeadcontroller : nsobject  @property (strong, nonatomic) nsstring *requesturl; @property (nonatomic, assign) iboutlet __unsafe_unretained id <mobfoxnativeaddelegate> delegate; @property (nonatomic, assign) bool locationawareadverts; @property (nonatomic, assign) nsinteger userage; @property (nonatomic, strong) nsstring* usergender; @property (nonatomic, strong) nsarray* keywords;  @property (nonatomic, strong) nsarray* adtypes;  - (void)setlocationwithlatitude:(cgfloat)latitude longitude:(cgfloat)longitude;  - (uiview*)getnativeadviewforresponse:(mobfoxnativead*)response xibname:(nsstring*)name;  - (void)requestad;  @end 

first, appear missing implementation of viewcontrollerfornativeads, listed in protocol , not in code posted.

are importing framework module @ top of .swift file?


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -