问题
I would try "How to generate .ipa file for react-native?" But I'cant get .ipa file.
Any one cloud you explain how to get .ipa file .
回答1:
How to build .ipa application for react-native-ios :
Get ".app" file :
Command :
react-native run-ios --configuration=release
".app" file path :
Build/Products/Release/"<Your_Filename>.app"
Convert
.app
to.ipa
:a. Create folder Payload.
b. paste
.app
file into Payload folder.c. compress the Payload folder.
d. change the name you want and put extension as
.ipa
.
回答2:
You can run these commands in the ios directory.
xcodebuild clean archive -scheme <Scheme> -configuration Release -archivePath ../builds/<App>.xcarchive DEVELOPMENT_TEAM=<DevTeam> PROVISIONING_PROFILE=<PROVISIONING_PROFILE> CODE_SIGN_IDENTITY=<CODE_SIGN_IDENTITY>
xcodebuild -exportArchive -archivePath ../builds/<App>.xcarchive -exportPath ../builds/ -exportOptionsPlist ./iosExportOptions.plist
and iosExportOptions.plist can be something like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>{TEAM_ID}</string>
</dict>
</plist>
You can also checkout fastlane. https://fastlane.tools/
OR
You can fill in all the details such as DEVELOPMENT_TEAM etc in Xcode and Product -> Archive https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html
回答3:
Delete localhost item from info.plist
App transport security settings -> Exception domains
Bundle ios
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
In Xcode
Products->Scheme->Edit scheme -> Change build configuration to
RELEASE
In
AppDelegate.m
Replace
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
with
#ifdef DEBUG jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif
Change device -> Generic iOS device
Product -> Clean
Product -> Build
.app
file can be found at~/Library/Developer/Xcode/DerivedData/<app name>/Build/Products/Release-iphoneos/<appname>
Create folder Payload.
Paste
.app
file into Payload folder.Compress the Payload folder.
Change the name you want and put extension as
.ipa
来源:https://stackoverflow.com/questions/42110496/how-to-build-ipa-application-for-react-native-ios