Skip to content

Commit

Permalink
(fix) add a cast to nsobject in order to avoid a build error in objec…
Browse files Browse the repository at this point in the history
…tive-c… (#379)

* add a cast to nsobject in order to avoid a build error in objective-c. Swift works fine. :/

* update travis yaml to user testapp master.  add comments
  • Loading branch information
thomaszurkan-optimizely authored Feb 26, 2019
1 parent dd704d4 commit 43a9e15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
env:
- SDK=objective-c
- BUILD_NUMBER=$TRAVIS_BUILD_NUMBER
- TESTAPP_TAG=master
cache: false
before_install: skip
install:
Expand Down
5 changes: 4 additions & 1 deletion OptimizelySDKShared/OptimizelySDKShared/OPTLYManagerBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,11 @@ - (void)cleanUserProfileService:(NSArray<OPTLYExperiment *><OPTLYExperiment> *)e
//#pragma clang diagnostic push
//#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
@try {
IMP imp = [self.userProfileService.class instanceMethodForSelector:selector];
// cast to NSObject. If the user profile service is not the default service, then an exception will be thrown when trying to access this selector.
IMP imp = [((NSObject *)(self.userProfileService)).class instanceMethodForSelector:selector];
// cast the function
void (*func)(id, SEL, NSArray *) = (void *)imp;
// call it.
func(self.userProfileService, selector, ids);
}
@catch(NSException *e) {
Expand Down

0 comments on commit 43a9e15

Please sign in to comment.