ios - Quickblox APIs in swift crashes with unrecognized selector -
i have issue quickblox when trying integrate code in swift.
below code ruuning in objective-c without error
appdellgate.m file
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [qbsettings setapplicationid:kapplicationid]; [qbsettings setauthkey:kauthkey]; [qbsettings setauthsecret:kauthsecret]; [qbsettings setaccountkey:kacconuntkey]; [[geodatamanager instance] fetchlatestcheckins]; return yes; }
geodatamanager.m file
@implementation geodatamanager + (instancetype)instance { static geodatamanager *instance = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ instance = [self new]; }); return instance; } - (void)fetchlatestcheckins { qblgeodatafilter* filter = [qblgeodatafilter new]; filter.lastonly = yes; filter.sortby = geodatasortbykindcreatedat; qbgeneralresponsepage *page = [qbgeneralresponsepage responsepagewithcurrentpage:1 perpage:70]; [qbrequest geodatawithfilter:filter page:page successblock:^(qbresponse *response, nsarray *objects, qbgeneralresponsepage *page) { [[datamanager shareddatamanager] savecheckins:objects]; } errorblock:^(qbresponse *response) { nslog(@"error = %@", response.error); }]; }
but when trying call same method swift base project below code
swift appdelegate.
func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // set quickblox credentials (you must create application in admin.quickblox.com). qbsettings.setapplicationid(kqbapplicationid) qbsettings.setauthkey(kqbauthkey) qbsettings.setauthsecret(kqbauthsecret) qbsettings.setaccountkey(kqbaccountkey) geodatamanager .instance().fetchlatestcheckins() return true }
i getting uncaught exception 'nsinvalidargumentexception', reason: '+[qbrequest geodatawithfilter:page:successblock:errorblock:]: unrecognized selector sent class.
i have added geodatamanager & created bridging header same.
could 1 please assist me doing wrong? idea or suggestion great.
seems don't have needed linker flags
- full guide http://quickblox.com/developers/ios-how-to-connect-quickblox-framework
- please take @ step 7:
add -lxml2, -objc, -lstdc++ flags other linker flags section in project settings
Comments
Post a Comment