diff --git a/.gitignore b/.gitignore index 3bc4336..66ea262 100755 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ Build/ build/ DerivedData -Podfile.lock Pods Pods/ ContentstackTest/TestResult/ diff --git a/CHANGELOG.md b/CHANGELOG.md index b3165ac..459f0eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### Version: 3.10.1 +#### Date: Nov-11-2022 + +##### Hot fix: +- Fix crash on NSInvalidArgumentException + ### Version: 3.10.0 #### Date: Aug-19-2022 diff --git a/Contentstack.podspec b/Contentstack.podspec index cb8f8fc..1656770 100644 --- a/Contentstack.podspec +++ b/Contentstack.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Contentstack' -s.version = '3.10.0' +s.version = '3.10.1' s.summary = 'Contentstack is a headless CMS with an API-first approach that puts content at the centre.' s.description = <<-DESC @@ -12,7 +12,7 @@ s.homepage = 'https://www.contentstack.com/' s.license = { :type => 'Commercial',:text => 'See https://www.contentstack.com/'} s.author = { 'Contentstack' => 'support@contentstack.io' } -s.source = { :git => 'https://github.com/contentstack/contentstack-ios.git', :tag => 'v3.10.0' } +s.source = { :git => 'https://github.com/contentstack/contentstack-ios.git', :tag => 'v3.10.1' } s.social_media_url = 'https://twitter.com/Contentstack' s.ios.deployment_target = '8.0' diff --git a/Contentstack.xcodeproj/project.pbxproj b/Contentstack.xcodeproj/project.pbxproj index 517f3ca..3c7a654 100644 --- a/Contentstack.xcodeproj/project.pbxproj +++ b/Contentstack.xcodeproj/project.pbxproj @@ -690,7 +690,7 @@ }; 23C545FD1C197722007BBD27 /* Framework Generation Script */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 12; files = ( ); inputPaths = ( diff --git a/Contentstack/Contentstack.h b/Contentstack/Contentstack.h index 3e6b06d..c449648 100644 --- a/Contentstack/Contentstack.h +++ b/Contentstack/Contentstack.h @@ -6,7 +6,7 @@ // Copyright (c) 2015 Contentstack. All rights reserved. // -// sdk-version: 3.10.0 +// sdk-version: 3.10.1 #import #import diff --git a/Contentstack/Info.plist b/Contentstack/Info.plist index f5e782b..cb51027 100644 --- a/Contentstack/Info.plist +++ b/Contentstack/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.10.0 + 3.10.1 CFBundleSignature ???? CFBundleVersion diff --git a/ContentstackInternal/CSIOCoreHTTPNetworking.m b/ContentstackInternal/CSIOCoreHTTPNetworking.m index d7aa43a..9041777 100644 --- a/ContentstackInternal/CSIOCoreHTTPNetworking.m +++ b/ContentstackInternal/CSIOCoreHTTPNetworking.m @@ -15,7 +15,7 @@ #import "NSObject+Extensions.h" #import "CSURLSessionManager.h" -NSString *const sdkVersion = @"3.10.0"; +NSString *const sdkVersion = @"3.10.1"; @interface CSIOCoreHTTPNetworking (){ id networkChangeObserver; @@ -372,7 +372,7 @@ - (NSURLSessionDataTask*)requestForStack:(Stack*)stack mutableRequest.HTTPMethod = @"GET"; NSURLSessionDataTask *task = [self.urlSessionManager dataTaskWithRequest:mutableRequest success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { - if (cachePolicy != NETWORK_ONLY || cachePolicy != CACHE_THEN_NETWORK) { + if ((cachePolicy != NETWORK_ONLY || cachePolicy != CACHE_THEN_NETWORK) && responseObject != nil) { [self saveToCacheDataTask:task responseObject:responseObject]; } completionBlock(resType, responseObject, nil); diff --git a/Docs/DocGenerationScript.sh b/Docs/DocGenerationScript.sh old mode 100644 new mode 100755 index b40ac97..565f5ab --- a/Docs/DocGenerationScript.sh +++ b/Docs/DocGenerationScript.sh @@ -24,8 +24,9 @@ target="iphoneos"; # End constants /usr/local/bin/appledoc \ --project-name "Contentstack" \ +--templates "${PROJECT_DIR}/../appledoc/Templates" \ --project-company "Contentstack.com" \ ---project-version "3.10.0" \ +--project-version "3.10.1" \ --company-id "${companyID}" \ --docset-bundle-id "${companyID}.${companyForFeed}" \ --docset-bundle-name "${companyForFeed}" \ @@ -46,3 +47,4 @@ target="iphoneos"; --index-desc "${PROJECT_DIR}/Docs/overview.md" \ --exit-threshold 2 \ ./Build/Products/Release-universal/Contentstack.framework/Headers + diff --git a/Docs/overview.md b/Docs/overview.md index 9eda39e..15ab3f6 100755 --- a/Docs/overview.md +++ b/Docs/overview.md @@ -11,23 +11,6 @@ Add the following line to your Podfile: Run `pod install`, and you should now have the latest Contentstack release. - -##### Manual - -1. Download the [Latest iOS SDK release](https://www.contentstack.com/docs/platforms/ios/ios_sdk_latest) and extract the zip file to your local disk. - -2. Drag and drop Contentstack.framework into your project folder in Xcode. - A window will appear, prompting you to choose one of the options for adding files. Click the ‘Destination’ checkbox to copy items into the destination group’s folder. This will add the SDK to your project. - -3. In the project editor, select your app under `TARGETS`. Under the `General` tab, open `Linked Frameworks and Libraries` and add the following libraries: - - CoreGraphics.framework - - MobileCoreServices.framework - - Security.framework - - SystemConfiguration.framework - -4. In your target app, click on the `Build Settings` tab and add the `-ObjC` flag to `Other Linker Flags`. - - #### Import Header/Module You can import header file in Objective-C project as: @@ -41,3 +24,42 @@ You can also import as a Module: //Swift import Contentstack + +#### Initializing your SDK + +To start using the SDK in your application, you will need to initialize the stack by providing the required keys and values associated with them: + + //Objc + Stack *stack = [Contentstack stackWithAPIKey: API_KEY accessToken: ACCESS_TOKEN environmentName: ENVIRONMENT]; + + //Swift + let stack:Stack = Contentstack.stackWithAPIKey(API_KEY, accessToken: ACCESS_TOKEN, environmentName: ENVIRONMENT) + +To get the api credentials mentioned above, you need to log into your Contentstack account and then in your top panel navigation, go to Settings -> Stack to view both your API Key and your Access Token + +The stack object that is returned is a Contentstack client object, which can be used to initialize different modules and make queries against our [Content Delivery API](https://contentstack.com/docs/apis/content-delivery-api/). The initialization process for each module is explained in the following section. + + +#### Querying content from your stack + +To fetch all entries of of a content type, use the query given below: + + //Objc + ContentType *contentTypeObject = [stack contentTypeWithName:@"my_content_type"]; + Query *queryObject = [contentTypeObj query]; + + //Swift + var contentTypeObject:ContentType = stack.contentTypeWithName("my_content_type") + var queryObject:Query = contentTypeObj.query() + + +To fetch a specific entry from a content type, use the following query: + + //Objc + ContentType * contentTypeObject = [stack contentTypeWithName:@"my_content_type"]; + Entry *entryObject = [contentTypeObject entryWithUID:@"ENTRY_UID"]; + + //Swift + var contentTypeObject:ContentType = stack.contentTypeWithName("my_content_type") + var entryObject:Entry = contentTypeObject.entryWithUID("ENTRY_UID") + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0d6b21e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2022 Contentstack + +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. diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..fd3b0f4 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,3 @@ +PODFILE CHECKSUM: e70b33906e829ccd2b052bc0e0cff91ee8ee49e6 + +COCOAPODS: 1.11.3 diff --git a/README.md b/README.md index 0eb22e0..e4b4ac5 100644 --- a/README.md +++ b/README.md @@ -17,21 +17,6 @@ Latest Xcode and Mac OS X To use this SDK on iOS platform, you will have to install the SDK according to the steps given below. - - -##### Manual - - -1. Download the [Latest iOS SDK release](https://www.contentstack.com/docs/platforms/ios/ios_sdk_latest) and extract the zip file to your local disk. -2. Drag and drop Contentstack.framework into your project folder in Xcode. A window will appear, prompting you to choose one of the options for adding files. Click the ‘Destination’ checkbox to copy items into the destination group’s folder. This will add the SDK to your project. -3. In the project editor, select your app under TARGETS. Under the General tab, open Linked Frameworks and Libraries and add the following libraries: -- CoreGraphics.framework -- MobileCoreServices.framework -- Security.framework -- SystemConfiguration.framework - -4. In your target app, click on the Build Settings tab and add the -ObjC flag to Other Linker Flags. - ##### CocoaPods 1. Add the following line to your Podfile: @@ -315,7 +300,7 @@ You can use advanced sync queries to fetch custom results while performing initi ### The MIT License (MIT) -Copyright © 2012-2020 [Contentstack](https://www.contentstack.com/). All Rights Reserved +Copyright © 2012-2022 [Contentstack](https://www.contentstack.com/). All Rights Reserved 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: diff --git a/Script/ios-build-framework-script.sh b/Script/ios-build-framework-script.sh index e0747fa..2f68535 100755 --- a/Script/ios-build-framework-script.sh +++ b/Script/ios-build-framework-script.sh @@ -37,7 +37,7 @@ fi # Build the other (non-simulator) platform xcodebuild -workspace "${PROJECT_NAME}.xcworkspace" -scheme "${SF_TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk iphoneos BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}/DependantBuilds/arm64" BUILD_ROOT="${BUILD_ROOT}" CONFIGURATION_BUILD_DIR="${IPHONE_DEVICE_BUILD_DIR}/arm64" SYMROOT="${SYMROOT}" ARCHS='arm64' VALID_ARCHS='arm64' $ACTION -xcodebuild -workspace "${PROJECT_NAME}.xcworkspace" -scheme "${SF_TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk iphoneos BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}/DependantBuilds/arm7" BUILD_ROOT="${BUILD_ROOT}" CONFIGURATION_BUILD_DIR="${IPHONE_DEVICE_BUILD_DIR}/armv7" SYMROOT="${SYMROOT}" ARCHS='armv7 armv7s' VALID_ARCHS='armv7 armv7s' $ACTION +#xcodebuild -workspace "${PROJECT_NAME}.xcworkspace" -scheme "${SF_TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk iphoneos BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}/DependantBuilds/arm7" BUILD_ROOT="${BUILD_ROOT}" CONFIGURATION_BUILD_DIR="${IPHONE_DEVICE_BUILD_DIR}/armv7" SYMROOT="${SYMROOT}" ARCHS='armv7 armv7s' VALID_ARCHS='armv7 armv7s' $ACTION # Copy the framework structure to the universal folder (clean it first) rm -rf "${UNIVERSAL_OUTPUTFOLDER}" @@ -49,8 +49,10 @@ cp -R "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SF_TARGET_NAME}.framework # Remove Info.plist file from universal folder rm -r "${UNIVERSAL_OUTPUTFOLDER}/${SF_TARGET_NAME}.framework/Info.plist" +lipo -remove arm64 "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" -output "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" + # Smash them together to combine all architectures -lipo -create "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/arm64/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/armv7/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" -output "${UNIVERSAL_OUTPUTFOLDER}/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" +lipo -create "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/arm64/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" -output "${UNIVERSAL_OUTPUTFOLDER}/${SF_TARGET_NAME}.framework/${SF_TARGET_NAME}" #Convenience step to copy the framework to the project's directory mkdir -p "${PROJECT_DIR}/Build"