Project wont run on simulator in xcode 8 - ios

After upgrading to xcode8, my project will no longer run on the simulator (runs on a device)
Error:
/Users/johnsmith/Library/Developer/Xcode/DerivedData/JT-fnslglvifmonzwhlgrchcqujqiwt/Build/Products/Debug-iphonesimulator/
Assets.bundle: Is a directory
Command /usr/bin/codesign failed with exit code 1
I have deleted the entire deriveddata folder and cleaned the project several times with no success. Any ideas how to fix please?

If you are using CocoaPods (especially an older version), you'll notice that all the resource bundle targets in the pods project file don't have an info.plist.
Set them all using CocoaPods generic Info.plist and it'll run.
This however is not a permanent solution. It will reset on next pod install
https://forums.developer.apple.com/thread/66538
EDIT:
If you don't happen to have a generic plist file in your project already
create a new file Info.plist in Pods Target Support Files/Pods-<App Name>/ and paste this
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
EDIT 2:
Fixed the values above. Apple won't accept it when uploading to App Store the way it previously was.
It shouldn't have CFBundleExecutable
and the CFBundlePackageType should be set to BNDL

Related

why the ipa file did not generated when build the flutter app

When I am using this command to build the ios ipa file:
➜ ios git:(master) ✗ ~/fvm/versions/2.5.0/bin/flutter build ipa
Changing current working directory to: /Users/xiaoqiangjiang/source/reddwarf/frontend/flutter-netease-music
Archiving com.reddwarf.musicapp...
Automatically signing iOS for device deployment using specified development team in Xcode project: 6JP4P88ZJB
Running pod install... 960ms
Running Xcode build...
└─Compiling, linking and signing... 4.7s
Xcode archive done. 40.8s
Built /Users/xiaoqiangjiang/source/reddwarf/frontend/flutter-netease-music/build/ios/archive/Runner.xcarchive.
💪 Building with sound null safety 💪
I did not found the ipa file in the build folder. what should I do to generate the ipa file? The log output did not show any error, did not show the ipa file path. I found the flutter archive option are unavaliable:
I have already tried to add the info.plist file in ${PROJECT}/ios/Runner/Info.plist:
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Music</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>dolphin</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
<string>external-accessory</string>
<string>fetch</string>
<string>location</string>
<string>processing</string>
<string>remote-notification</string>
<string>voip</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
and when I using the xcode 14.1 to archive the app, it works but could not build the app with the flutter command.
First try to generate your ipa With flutter build ipa if no error occured you will find your ipa in build ios name as archive you just need to open it with your xcode.
I finally tried to using this command to build:
~/fvm/versions/2.5.0/bin/flutter build ipa --export-options-plist=/Users/xiaoqiangjiang/source/reddwarf/frontend/flutter-netease-music/ios/Runner/Info.plist --release

Flutter / iOS : Could not determine bundle id

In my Flutter project, I try to compile and run my app. It works fine on Android but for some reason, out of nowhere, I now have the following error when I run my app on iOS:
2022-06-11 16:21:02.274 ios-deploy[42320:338779] [ !! ] [ ERROR] Could not determine bundle id.
Could not run build/ios/iphoneos/Runner.app on 00008030-001C085222DA803E.
So here is what I checked:
Info.plist: there is Bundle identifier with the value $(PRODUCT_BUNDLE_IDENTIFIER)
In TARGETS > Runner > Build Settings > Packaging > Product Bundle Identifier, I have the expected value (my package name)
In TARGETS > Runner > General > Bundle Identifier, the value is set as expected (my package name)
In TARGETS > Runner > Build Settings > Packaging > Info.plist File, I have the correct location: Runner/Info.plist
I tried flutter clean, Invalidate caches & Restart on Android Studio, Clean Build Folder on Xcode
I tried even more cleaning as explained here
And here is my Info.plist file:
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>$(APP_DISPLAY_NAME)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Wezeejay</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ENVIRONNEMENT</key>
<string>$(ENVIRONNEMENT)</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSCameraUsageDescription</key>
<string>NSCameraUsageDescription</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
But I still have that error just when the app is about to launch, which I have no idea where it comes from since it was working perfectly just two days ago.
Does anyone know how to fix that?
Thanks.
Open the workspace file in xcode. Select runner from the side panel and select general tab. You should be able to see the bundle id. Add bundle id in this section
EDIT
/Users//Library/Developer/Xcode/DerivedData
remove all contents of this folder and from Xcode go to product, clean build folder and then build again
Change use Release for command line builds to debug and build once. Then switch it back to release
I finally managed to make it work by:
updating Mac OS
unstalling and installing the latest version of Xcode

"Cannot find executable for CFBundle" while loading bundle with resources only

I'm using an NSBundle to load localization files into my iOS app.
Since I'm building with Xcode 11 everything is still working as expected, but I get a warning each time I read localizations from that bundle:
Cannot find executable for CFBundle [...] (not loaded)
The thing is there is no executable in the bundle. It contains nothing but the localization files and an Info.plist which looks like this:
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
The bundle is loaded with
NSBundle *bundle = [NSBundle bundleWithPath:path];
if (![bundle isLoaded]) {
[bundle load];
}
and the localization read with
NSString *string = [bundle localizedStringForKey:key value:defaultValue table:nil];
Apparently - load from NSBundle is only there to load executables from a bundle.
From the documentation:
Dynamically loads the bundle’s executable code into a running program, if the code has not already been loaded.
For bundles with only resources it's not necessary to call - load.

Archive upload error: ERROR ITMS-90207 - The bundle does not contain a bundle executable

I have an iOS app developed in Swift 2.1.1 with Xcode 7.2. The app runs perfectly and Xcode creates an archive with no problem, but upon uploading it to the app store (iTunes Connect) I get the following error:
ERROR ITMS-90207: "Invalid Bundle. The bundle at 'My App Name.app'
does not contain a bundle executable."
I have tried any suggestions I could find with no improvement whatsoever. How do I fix this issue? How can I find the cause? Is there a workaround?
I use several libraries with CocoaPods, my Podfile:
platform :ios, '8.0'
use_frameworks!
target 'My App Name' do
pod 'RealmSwift'
pod 'SwiftDateExtension'
pod "JDFTooltips"
end
target 'My App NameTests' do
pod 'RealmSwift'
end
My Info.plist:
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Text removed</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Text removed</string>
<key>UILaunchStoryboardName</key>
<string>Launch Screen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
I tried any suggestion I could find including:
Bundle id is set in app target, re-added info.plist (source)
CFBundleExecutable is set in the Info.plist (source)
Device connected or not makes no difference (source)
Disabling bit codes
I went into the archive to ensure it contains an executable and the Plist file links to it (from what I can gather) correctly. Even removed spaces in the name to ensure that's not the issue.
Turns out the NSHumanReadableCopyright broke the Info.plist. Completely removing the key from the Info.plist solved the issue (removing just the © character wasn't enough).
I think it's a fair suggestion to anyone experiencing a similar issue to try to submit an archive with a default, unmodified, Info.plist to see if that works. From my experience you can submit as many times as you want so don't hesitate to experiment.
I added the key because Apple suggests doing so in their documentation: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW29.
Seems weird and stupid for their verification process to break and point to the executable when they can't interpret the Info.plist.

How to generate entitlements in xml format without xcode?

I have to build ios application, but without using xcode.
Problem is in pass entitlements to application.
My entitlements file looks like this:
<?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>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.domain</string>
</array>
</dict>
</plist>
and xcode formats it to this (.xcent file):
<?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>application-identifier</key>
<string>A1B2C3D4E5.product.name</string>
<key>com.apple.developer.team-identifier</key>
<string>E5D4C3B2E1</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>A1B2C3D4E5.com.domain</string>
</array>
</dict>
</plist>
by using the command:
builtin-productPackagingUtility app.entitlements -entitlements -format xml -o ${HOME}/Library/Developer/Xcode/DerivedData/app//Build/Intermediates/app.build/Debug-iphoneos/app.build/app.xcent
Can anybody explain what exactly this command does and how can i invoke it manually? Or how can i simulate this command call by my hand?
Thanks.
If you can use xcodebuild, builtin-productPackagingUtility will be invoked as a step. You simply need to supply entitlements as a build setting variable in the command line.
This library will create a xcent file you can use for codesigning.
https://github.com/sotownsend/iarrogant
Note: I haven't tested the library.
You can also grab the resulting xcent file from an ipa created with xcodebuild and use that to sign future releases. You would have to keep these files in sync as your entitlements change.

Resources