Makes it easier to support older versions of iOS by fixing things and adding missing methods

Overview

PSTModernizer

PSTModernizer carefully applies patches to UIKit and related Apple frameworks to fix known radars with the least impact. The current set of patches just applies to iOS 9 and nothing is executed on iOS 10, as the bugs have been fixed there.

This project later on might also patch-add a few essential missing elements in iOS 10 if there's need - currently the focus is just to fix various bugs.

Installation

Simply copy PSTModernizer.h/mm into your project, then call [PSTModernizer installModernizer]; somewhere early, ideally in your app delegate.

Currently covers following radars (all of them have been fixed in iOS 10)

You can simply delete the workarounds that do not affect you - every workaround is self-contained and can be individually removed.

FAQ

Q: Why?
A: Because we need to support older UIKit versions. At PSPDFKit we support n-1, so we're just about to drop iOS 8 and will likely use something like this for our next major release. This project should make it easier to patch up the system so you need to write less ugly code.

Q: Isn't that partly using private API?
A: Partly. The goal is to write workarounds using just public API, but it's not always possible or would lead to much more scary code. If we revert to private API, we use it for good, not evil. You decide. Since we restrict API usage to versions that have been already released and don't apply it to unknown versions, the risk is minimal. If you do find a way to patch things without private API that are similary effective and not 10x the code, please submit a pull request. We also only use it to work around bugs, not for accessing new features. Of course I can't make any guarantees if Apple accepts this on app review. (but so far we have not gotten a report that blocks this, and worst case you disable the parts that are private and just have a slightly more broken app.)

License

The MIT License (MIT)

Copyright (c) 2016 Peter Steinberger, PSPDFKit GmbH.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

This project is maintained and funded by PSPDFKit.

See our other open source projects, read our blog or say hello on Twitter (@PSPDFKit).

You might also like...
Trackable is a simple analytics integration helper library. It’s especially designed for easy and comfortable integration with existing projects.

Trackable Trackable is a simple analytics integration helper library. It’s especially designed for easy and comfortable integration with existing proj

Type-safe observable values and collections in Swift

GlueKit ⚠️ WARNING ⚠️ This project is in a prerelease state. There is active work going on that will result in API changes that can/will break code wh

Find common xib and storyboard-related problems without running your app or writing unit tests.
Find common xib and storyboard-related problems without running your app or writing unit tests.

IBAnalyzer Find common xib and storyboard-related problems without running your app or writing unit tests. Usage Pass a path to your project to ibanal

Exclude files and folders from Alfred’s search results
Exclude files and folders from Alfred’s search results

Ignore in Alfred Alfred Workflow Exclude files and folders from Alfred’s search results ⤓ Download Workflow About The macOS metadata search API only a

iOS project bootstrap aimed at high quality coding.
iOS project bootstrap aimed at high quality coding.

iOS Project bootstrap How do you setup your iOS projects? Since we are approaching 2015 I’m working on refreshing my project bootstrap. I’ve decided t

Find memory leaks in your iOS app at develop time.

中文介绍 | FAQ中文 MLeaksFinder MLeaksFinder helps you find memory leaks in your iOS apps at develop time. It can automatically find leaks in UIView and UIV

Find memory issues & leaks in your iOS app without instruments
Find memory issues & leaks in your iOS app without instruments

HeapInspector Find memory issues & leaks in your iOS app HeapInspector is a debug tool that monitors the memory heap with backtrace recording in your

iOS library to help detecting retain cycles in runtime.

FBRetainCycleDetector An iOS library that finds retain cycles using runtime analysis. About Retain cycles are one of the most common ways of creating

Awesome bug reporting for iOS apps
Awesome bug reporting for iOS apps

Buglife is an awesome bug reporting SDK & web platform for iOS apps. Here's how it works: User takes a screenshot, or stops screen recording User anno

Comments
  • Add podspec and example project

    Add podspec and example project

    Description

    This PR adds a podfile configured for 1.0.0. This will allow CocoaPods users to add PSTModernizer to their Podfiles using the following syntax:

    pod 'PSTModernizer'
    

    CocoaPods likes to have a single example project so instead of clobbering the existing two I added a third in the "CocoaPods Example" folder. I don't think this will satisfy the needs of pod try PSTModernizer but it's enough to show someone how to use the library. This can be improved in a future PR, if needed.

    I left out tests as I didn't want to dictate what kind of unit or UI tests to be run. The CocoaPods example would be a good place to gather those tests, though, when runners and specs are decided.

    TODO

    These issues seemed outside the scope of this PR so I leave them to a repo owner to execute before this PR is merged.

    Tagging 1.0.0

    Because this podspec is marked for 1.0.0 this repo will need a matching tag. This tag can be accomplishes with the following command:

    git tag -a 1.0.0 -m "1.0.0 release" && git push origin 1.0.0
    

    After the tag is pushed the podspec can be linted using

    pod spec lint
    

    Releasing the podspec

    The podspec will need to be pushed into CocoaPods' trunk. If you're not already registered with the trunk that can be done thusly:

    pod trunk register [email protected] 'Peter Steinberger' --description='Office rMBP'
    

    After registering the podspec can be pushed using

    pod repo push PSTModernizer PSTModernizer.podspec --verbose
    
    opened by adamyanalunas 4
  • Cocoapods

    Cocoapods

    Hi,

    I think adding this to Cocoapods would be nice. Here is a podspec file you could user :

    Pod::Spec.new do |s|
      s.name     = 'PSTModernizer'
      s.version  = '1.0'
      s.license  = 'MIT'
      s.summary  = 'Makes it easier to support older versions of iOS by fixing things and adding missing methods'
      s.homepage = 'https://github.com/PSPDFKit-labs/PSTModernizer'
      s.author   = { 'PSPDFKit Labs' => 'https://pspdfkit.com/' }
      s.source   = { :git => 'https://github.com/PSPDFKit-labs/PSTModernizer.git', :tag => s.version.to_s }
      s.source_files = 'PSTModernizer/*.{h,m,mm}'
      s.requires_arc = true
    
      s.xcconfig = { 'CLANG_MODULES_AUTOLINK' => 'YES' }
      s.ios.deployment_target = '6.0'
      s.tvos.deployment_target = '9.0'
    
    end
    

    The minimum iOS version could be adjusted, haven't been able to guess which one would be used. To support cocoapod versioning I usually tag each new version, and change the version number in the podspec.

    To push to Cocoapods :

    # checks if the podfile is correct and the code compiles 
    pod lib lint
    # push to the public cocoapods repo
    pod trunk push PSTModernizer.podspec
    
    opened by dvkch 3
  • PST_PARTIAL_AVAILABILITY_BEGIN compilation error

    PST_PARTIAL_AVAILABILITY_BEGIN compilation error

    I'm not exactly sure what PST_PARTIAL_AVAILABILITY_BEGIN/PST_PARTIAL_AVAILABILITY_END should mean, but it seems like they have been forgotten in file defines:

    PSTModernizer/PSTModernizer/PSTModernizer.mm:96:5: Use of undeclared identifier 'PST_PARTIAL_AVAILABILITY_BEGIN'
    PSTModernizer/PSTModernizer/PSTModernizer.mm:96:5: Use of undeclared identifier 'PST_PARTIAL_AVAILABILITY_END'
    PSTModernizer/PSTModernizer/PSTModernizer.mm:141:5: Use of undeclared identifier 'PST_PARTIAL_AVAILABILITY_BEGIN'
    PSTModernizer/PSTModernizer/PSTModernizer.mm:141:5: Use of undeclared identifier 'PST_PARTIAL_AVAILABILITY_END'
    

    From this snippet:

    #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
    #define PST_IF_IOS10_0_OR_GREATER(...) \
    if (PST_IS_IOS10_0_OR_GREATER) { \
    PST_PARTIAL_AVAILABILITY_BEGIN \
    __VA_ARGS__ \
    PST_PARTIAL_AVAILABILITY_END }
    #else
    #define PST_IF_IOS10_0_OR_GREATER(...)
    #endif
    
    opened by elfenlaid 0
Owner
PSPDFKit Labs
The leading framework for displaying, annotating and editing PDFs on iOS, Android, Windows and the Web. Account for open source projects.
PSPDFKit Labs
A static source code analysis tool to improve quality and reduce defects for C, C++ and Objective-C

OCLint - https://oclint.org OCLint is a static code analysis tool for improving quality and reducing defects by inspecting C, C++ and Objective-C code

The OCLint Static Code Analysis Tool 3.6k Dec 29, 2022
Measure Swift code metrics and get reports in Xcode, Jenkins and other CI platforms.

Taylor ⚠️ Taylor is DEPRECATED. Use SwiftLint instead. A tool aimed to increase Swift code quality, by checking for conformance to code metrics. Taylo

YOPESO 301 Dec 24, 2022
Skredvarsel app - an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API

Skredvarsel (Avalanche warning) app is an iOS, iPadOS, and macOS application that provides daily avalanche warnings from the Norwegian Avalanche Warning Service API

Jonas Follesø 8 Dec 15, 2022
Simple iOS app blackbox assessment tool. Powered by frida.re and vuejs.

Discontinued Project This project has been discontinued. Please use the new Grapefruit #74 frida@14 compatibility issues frida@14 introduces lots of b

Chaitin Tech 1.6k Dec 16, 2022
iOS tool that helps with profiling iOS Memory usage.

FBMemoryProfiler An iOS library providing developer tools for browsing objects in memory over time, using FBAllocationTracker and FBRetainCycleDetecto

Facebook Archive 3.4k Dec 7, 2022
A tool for Swift code modification intermediating between code generation and formatting.

swift-mod A tool for Swift code modification intermediating between code generation and formatting. Overview swift-mod is a tool for Swift code modifi

Ryo Aoyama 95 Nov 3, 2022
SwiftCop is a validation library fully written in Swift and inspired by the clarity of Ruby On Rails Active Record validations.

SwiftCop is a validation library fully written in Swift and inspired by the clarity of Ruby On Rails Active Record validations. Objective Build a stan

Andres Canal 542 Sep 17, 2022
A command-line tool and Xcode Extension for formatting Swift code

Table of Contents What? Why? How? Command-line tool Xcode source editor extension Xcode build phase Via Applescript VSCode plugin Sublime Text plugin

Nick Lockwood 6.3k Jan 8, 2023
A tool to enforce Swift style and conventions.

SwiftLint A tool to enforce Swift style and conventions, loosely based on the now archived GitHub Swift Style Guide. SwiftLint enforces the style guid

Realm 16.9k Jan 9, 2023
Cross-platform static analyzer and linter for Swift.

Wiki • Installation • Usage • Features • Developers • License Tailor is a cross-platform static analysis and lint tool for source code written in Appl

Sleekbyte 1.4k Dec 19, 2022