FWVersionManager


@interface FWVersionManager : NSObject

版本管理器

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, class, readonly, strong) FWVersionManager * _Nonnull sharedInstance
  • 当前版本号,可自定义。小于最新版本号表示需要更新,大于最新版本号表示正在审核

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull currentVersion;
  • 最新版本号,可自定义。默认从AppStore获取

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable latestVersion;
  • 当前版本状态,可自定义。根据最新版本号和当前版本号比较获得

    Declaration

    Objective-C

    @property (nonatomic) enum FWVersionStatus status;
  • 最新版本更新备注,可自定义。默认从AppStore获取

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable releaseNotes;
  • 应用Id,可选,默认自动根据BundleId获取

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable appId;
  • 地区码,可选,仅当app不能在美区访问时提供。示例:中国-cn

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable countryCode;
  • 版本发布延迟检测天数,可选,默认1天,防止上架后AppStore缓存用户无法立即更新

    Declaration

    Objective-C

    @property (nonatomic) NSInteger delayDays;
  • 数据版本号,可自定义。当数据版本号小于当前版本号时,会依次执行数据更新句柄

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nullable dataVersion;
  • Undocumented

    Declaration

    Objective-C

    - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
  • 检查应用版本号并进行比较,检查成功时回调。interval为频率(天),0立即检查,1一天一次,7一周一次

    Declaration

    Objective-C

    - (BOOL)checkVersion:(NSInteger)interval
              completion:(void (^_Nullable __strong)(void))completion;
  • 跳转AppStore更新页

    Declaration

    Objective-C

    - (void)openAppStore;
  • 检查数据版本号并指定版本迁移方法,调用migrateData之前生效,仅会调用一次

    Declaration

    Objective-C

    - (BOOL)checkDataVersion:(NSString *_Nonnull)version
                    migrator:(void (^_Nonnull __strong)(void))migrator;
  • 比较数据版本号并依次进行数据迁移,迁移完成时回调(不执行迁移不回调)

    Declaration

    Objective-C

    - (BOOL)migrateData:(void (^_Nullable __strong)(void))completion;