diff --git a/Dist/OAuthiOS.framework/Versions/A/OAuthiOS b/Dist/OAuthiOS.framework/Versions/A/OAuthiOS index 076e24a..c836705 100644 Binary files a/Dist/OAuthiOS.framework/Versions/A/OAuthiOS and b/Dist/OAuthiOS.framework/Versions/A/OAuthiOS differ diff --git a/OAuth.io.podspec b/OAuth.io.podspec index 36c5564..136fe69 100644 --- a/OAuth.io.podspec +++ b/OAuth.io.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "OAuth.io" - s.version = "1.2.2" + s.version = "1.2.4" s.summary = "OAuth that just works!" s.description = <<-DESC @@ -71,7 +71,7 @@ Pod::Spec.new do |s| # Supports git, hg, bzr, svn and HTTP. # - s.source = { :git => "https://github.com/oauth-io/oauth-ios.git", :tag => "1.2.2" } + s.source = { :git => "https://github.com/oauth-io/oauth-ios.git", :tag => "1.2.4" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # diff --git a/OAuthiOS.xcodeproj/project.pbxproj b/OAuthiOS.xcodeproj/project.pbxproj index 2a1b7c6..59199b6 100644 --- a/OAuthiOS.xcodeproj/project.pbxproj +++ b/OAuthiOS.xcodeproj/project.pbxproj @@ -242,7 +242,7 @@ 710D9EAC19507E4D00FA70A1 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = OAuth.io; }; buildConfigurationList = 710D9EAF19507E4D00FA70A1 /* Build configuration list for PBXProject "OAuthiOS" */; @@ -309,7 +309,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -e\n\n# If we're already inside this script then die\nif [ -n \"$RW_MULTIPLATFORM_BUILD_IN_PROGRESS\" ]; then\nexit 0\nfi\nexport RW_MULTIPLATFORM_BUILD_IN_PROGRESS=1\n\nRW_FRAMEWORK_NAME=${PROJECT_NAME}\nRW_INPUT_STATIC_LIB=\"lib${PROJECT_NAME}.a\"\nRW_FRAMEWORK_LOCATION=\"${BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework\"\n\nfunction build_static_library {\n # Will rebuild the static library as specified\n # build_static_library sdk\n xcrun xcodebuild -project \"${PROJECT_FILE_PATH}\" \\\n -target \"${TARGET_NAME}\" \\\n -configuration \"${CONFIGURATION}\" \\\n -sdk \"${1}\" \\\n ONLY_ACTIVE_ARCH=NO \\\n BUILD_DIR=\"${BUILD_DIR}\" \\\n OBJROOT=\"${OBJROOT}\" \\\n BUILD_ROOT=\"${BUILD_ROOT}\" \\\n SYMROOT=\"${SYMROOT}\" $ACTION\n}\n\nfunction make_fat_library {\n # Will smash 2 static libs together\n # make_fat_library in1 in2 out\n xcrun lipo -create \"${1}\" \"${2}\" -output \"${3}\"\n}\n\n# 1 - Extract the platform (iphoneos/iphonesimulator) from the SDK name\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]; then\nRW_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho \"Could not find platform name from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\n# 2 - Extract the version from the SDK\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]; then\nRW_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\n# 3 - Determine the other platform\nif [ \"$RW_SDK_PLATFORM\" == \"iphoneos\" ]; then\nRW_OTHER_PLATFORM=iphonesimulator\nelse\nRW_OTHER_PLATFORM=iphoneos\nfi\n\n# 4 - Find the build directory\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$RW_SDK_PLATFORM$ ]]; then\nRW_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${RW_OTHER_PLATFORM}\"\nelse\necho \"Could not find other platform build directory.\"\nexit 1\nfi\n\n# Build the other platform.\nbuild_static_library \"${RW_OTHER_PLATFORM}${RW_SDK_VERSION}\"\n\n# If we're currently building for iphonesimulator, then need to rebuild\n# to ensure that we get both i386 and x86_64\nif [ \"$RW_SDK_PLATFORM\" == \"iphonesimulator\" ]; then\nbuild_static_library \"${SDK_NAME}\"\nfi\n\n# Join the 2 static libs into 1 and push into the .framework\nmake_fat_library \"${BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}\" \\\n\"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}\" \\\n\"${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}\"\n\n# Ensure that the framework is present in both platform's build directories\ncp -a \"${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}\" \\\n\"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework/Versions/A/${RW_FRAMEWORK_NAME}\"\n\n# Copy the framework to the user's desktop\nditto \"${RW_FRAMEWORK_LOCATION}\" \"./Dist/${RW_FRAMEWORK_NAME}.framework\"\n#\"${HOME}/Desktop/${RW_FRAMEWORK_NAME}.framework\""; + shellScript = "set -e\n\n# If we're already inside this script then die\nif [ -n \"$RW_MULTIPLATFORM_BUILD_IN_PROGRESS\" ]; then\nexit 0\nfi\nexport RW_MULTIPLATFORM_BUILD_IN_PROGRESS=1\n\nRW_FRAMEWORK_NAME=${PROJECT_NAME}\nRW_INPUT_STATIC_LIB=\"lib${PROJECT_NAME}.a\"\nRW_FRAMEWORK_LOCATION=\"${BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework\"\n\nfunction build_static_library {\n # Will rebuild the static library as specified\n # build_static_library sdk\n xcrun xcodebuild -project \"${PROJECT_FILE_PATH}\" \\\n -target \"${TARGET_NAME}\" \\\n -configuration \"${CONFIGURATION}\" \\\n -sdk \"${1}\" \\\n ONLY_ACTIVE_ARCH=NO \\\n BUILD_DIR=\"${BUILD_DIR}\" \\\n OBJROOT=\"${OBJROOT}\" \\\n BUILD_ROOT=\"${BUILD_ROOT}\" \\\n SYMROOT=\"${SYMROOT}\" $ACTION\n}\n\nfunction make_fat_library {\n # Will smash 2 static libs together\n # make_fat_library in1 in2 out\n xcrun lipo -create \"${1}\" \"${2}\" -output \"${3}\"\n}\n\n# 1 - Extract the platform (iphoneos/iphonesimulator) from the SDK name\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]; then\nRW_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho \"Could not find platform name from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\n# 2 - Extract the version from the SDK\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]; then\nRW_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\n# 3 - Determine the other platform\nif [ \"$RW_SDK_PLATFORM\" == \"iphoneos\" ]; then\nRW_OTHER_PLATFORM=iphonesimulator\nelse\nRW_OTHER_PLATFORM=iphoneos\nfi\n\n# 4 - Find the build directory\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$RW_SDK_PLATFORM$ ]]; then\nRW_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${RW_OTHER_PLATFORM}\"\nelse\necho \"Could not find other platform build directory.\"\nexit 1\nfi\n\n# Build the other platform.\nbuild_static_library \"${RW_OTHER_PLATFORM}${RW_SDK_VERSION}\"\n\n# If we're currently building for iphonesimulator, then need to rebuild\n# to ensure that we get both i386 and x86_64\nif [ \"$RW_SDK_PLATFORM\" == \"iphonesimulator\" ]; then\nbuild_static_library \"${SDK_NAME}\"\nfi\n\n# Join the 2 static libs into 1 and push into the .framework\nmake_fat_library \"${BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}\" \\\n\"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}\" \\\n\"${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}\"\n\n# Ensure that the framework is present in both platform's build directories\ncp -a \"${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}\" \\\n\"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework/Versions/A/${RW_FRAMEWORK_NAME}\"\n\n# Copy the framework to the user's desktop\nditto \"${RW_FRAMEWORK_LOCATION}\" \"./Dist/${RW_FRAMEWORK_NAME}.framework\"\n#\"${HOME}/Desktop/${RW_FRAMEWORK_NAME}.framework\"\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -359,14 +359,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -402,14 +408,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/OAuthiOS/Src/OAuthIOModal.m b/OAuthiOS/Src/OAuthIOModal.m index 5c436e7..0e8ae33 100644 --- a/OAuthiOS/Src/OAuthIOModal.m +++ b/OAuthiOS/Src/OAuthIOModal.m @@ -38,11 +38,12 @@ - (void)viewDidLoad [_browser setFrame:CGRectMake(0, _navigationBarHeight, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height - _navigationBarHeight - 1)]; _browser.autoresizesSubviews = YES; - _browser.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); + _browser.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth); + _browser.scalesPageToFit = true; + _browser.contentMode = UIViewContentModeScaleAspectFit; [_browser setDelegate:self]; [[self view] addSubview:_browser]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getTokens:) name:@"OAuthIOGetTokens" object:nil]; } @@ -163,7 +164,7 @@ - (void)getTokens:(NSString *)url NSString *code = [[request getCredentials] objectForKey:@"code"]; NSString *post = [NSString stringWithFormat:@"code=%@", code]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; - NSString *postLength = [NSString stringWithFormat:@"%lu", [postData length]]; + NSString *postLength = [NSString stringWithFormat:@"%tu", [postData length]]; NSMutableURLRequest *state_request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:_authUrl] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; @@ -250,6 +251,8 @@ - (void)initNavigationBar { _navigationBar = [[UINavigationBar alloc] init]; [_navigationBar setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth]; + _navigationBar.translucent = NO; + _navigationBar.barTintColor = [UIColor lightGrayColor]; UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@""]; UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop target:nil action:@selector(cancelOperation)]; @@ -266,7 +269,12 @@ - (void)initNavigationBar - (void)drawNavigationBar { CGFloat width = CGRectGetWidth(self.view.bounds); - [_navigationBar setFrame:CGRectMake(0, 0, width, _navigationBarHeight)]; + UIView *statusbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 20)]; + [statusbar setAutoresizingMask: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | + UIViewAutoresizingFlexibleWidth]; + statusbar.backgroundColor = [UIColor lightGrayColor]; + [self.view addSubview:statusbar]; + [_navigationBar setFrame:CGRectMake(0, 20, width, _navigationBarHeight)]; [self.view addSubview:_navigationBar]; } @@ -284,7 +292,7 @@ - (void)cancelOperation if ([self.delegate respondsToSelector:@selector(didFailWithOAuthIOError:)]) [self.delegate didFailWithOAuthIOError:error]; - [_browser loadHTMLString:nil baseURL:nil]; + [_browser loadHTMLString:@"" baseURL:[NSURL URLWithString:@""]]; [self dismissViewControllerAnimated:YES completion:nil]; } diff --git a/README.md b/README.md index 393280f..ed01267 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Getting the SDK To install this SDK in your iOS app, you can either: - Get the framework from Cocoapods -- Install the framework by hand in XCode +- Install the framework by hand in Xcode Both options are pretty simple. @@ -36,7 +36,7 @@ This will get the framework for you and install it as a project dependency. Once **Installing the framework manually** -The framework is available in this repository as the `Dist/OAuthiOS.framework` file. To add it as a dependency in your projet in XCode, follow this procedure: +The framework is available in this repository as the `Dist/OAuthiOS.framework` file. To add it as a dependency in your projet in Xcode, follow this procedure: - click on the project name in the Documents explorer - go to **Build phases** - open the **Link Binary with Libraries** section @@ -253,6 +253,42 @@ To know when the process is done, you need to add the following methods to your The first one will catches a successfull authentication (which usually means the authentication URL returned "200 OK") and give you the body and response objects it got from that URL. The second one will catch errors (state token not found, unsucessfull authentication). +Building +======== + +There is excellent instruction on building/updating your cocoapod [https://sebastiandobrincu.com/blog/how-to-update-your-cocoapods-library-version](here) + +In brief: + +1. Update the 'version' in OAuth.io.podspec file +2. Tag the master branch with: +* `git tag {{VERSION}} -m 'Version Message' +* `git push origin --tags +3. Check if your Pod passess verification: +* `pod spec lint OAuth.io.podspec` +4. Register a Trunk session +* `pod trunk register name@company 'Firstname Lastname' --description='OAuth.io'` +5. Push new Pod version using trunk: +* `pod trunk push OAuth.io.podspec` + +Errors +====== + +When building, if you get: + +``` + pod spec lint OAuth.io.podspec + + -> OAuth.io (1.2.3) + - ERROR | [iOS] unknown: Encountered an unknown error (/usr/bin/xcrun simctl list -j devices + +xcrun: error: unable to find utility "simctl", not a developer tool or in PATH +) during validation. + +Analyzed 1 podspec. +``` + * Download the latest XCode (not just the CLI) + * Open XCode and goto 'XCode' -> 'Preferences' -> 'Location' Contributing ============