GBFeatureManager 2.0.0

GBFeatureManager 2.0.0

TestsTested
LangLanguage Obj-CObjective C
License Apache 2
ReleasedLast Release Aug 2017

Maintained by Luka Mirosevic.



 
Depends on:
GBToolbox>= 22.4
GBStorage~> 2.1
 

  • By
  • Luka Mirosevic

Simple iOS and Mac OS X feature manager for unlocking functionality (e.g. for IAP purchases).

Usage

Unlock a feature (all features are locked by default):

[GBFeatureManager unlockFeature:@"speedBoost"];

Lock a feature:

[GBFeatureManager lockFeature:@"speedBoost"];

Check to see if a feature is unlocked:

[GBFeatureManager isFeatureUnlocked:@"speedBoost"];		//Returns: YES or NO

If you want to unlock all features + any future features, think of it as an "all features unlocked override" (N.B. this will supersede any individual setting):

[GBFeatureManager enableWildcardFeatureOverride];

To turn off the "all features unlocked override":

[GBFeatureManager disableWildcardFeatureOverride];

To enabled features by default (e.g. Pro version), you can unlock some features directly in the Info.plist by adding it as a key to the Plist, prefixed by GBFeatureManager: and setting the value to a Boolean.

<key>GBFeatureManager:com.goonbee.proVersion</key>
<true/>

...normally you would do this in Xcode's Plist editor by simply adding a new row with the key GBFeatureManager:com.goonbee.proVersion, setting the type to Boolean and the value to either YES or NO.

Don't forget to import header, for iOS:

#import "GBFeatureManager.h"

... or on OSX:

#import <GBFeatureManager/GBFeatureManager.h>

Storage mechanics

Features are each stored to disk in simple serialized NSNumber objects to the NSDocumentsDirectory on iOS, or NSApplicationSupportDirectory OS X.

When checking whether a feature is available, the disk is only accessed the first time, and the result is cached in memory, subsequent checks never hit the disk.

Dependencies

iOS: Add to your project's workspace, add dependency for GBToolbox-iOS and GBStorageController-iOS, link with your binary, add -ObjC linker flag, add header search path.

OS X: Add to your project's workspace, add dependency for GBToolbox-OSX and GBStorageController-OSX, link with your binary, add "copy file" step to copy framework into bundle.

Copyright & License

Copyright 2013 Luka Mirosevic

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Bitdeli Badge