I am trying to create objective C Network framework using Xcode 15 with minimum supported iOS version 14.0.
Here are the steps I am following:
I created New> Project> framework> Objective C> storyboard> Create.
Made
NetworkManager.h
file created by project to public.Added two files
MyNetworkRequest.h
andMyNetworkRequest.m.
Made
MyNetworkRequest.h
>Public
from inspector.Added
#import < NetworkManager/MyNetworkRequest.h>
in theNetworkManager.h
From Project > Target > Build Setting > set
SKIP_INSTALL = NO
andBuild Libraries for distribution = YES
Added script for making framework : select target from top bar> Edit scheme> Archive> Post action> Add run script> copy pasted following script:
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-Universal # Build Device and Simulator versions xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build # Copy the framework structure (from iphoneos build) to the universal folder cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" # iOS - Copy the framework structure to the universal folder (clean it first) rm -rf "${UNIVERSAL_OUTPUTFOLDER}" # Make sure the output directory exists mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" # Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory BUILD_PRODUCTS="${SYMROOT}/../../../../Products" cp -R "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" # Create universal binary file using lipo and place the combined executable in the copied framework directory lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_PRODUCTS}/Debug-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" # Copy the framework to the project directory cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}" # Open the project directory in Finder #open "${PROJECT_DIR}" fi
build and make archive.
Open the archive by right clicking and show file content> does not contain framework in any enclosing folder.
Objective-C