I've got a relatively simple one here. I'm making bundles to live inside the Resources folder of my application (and possibly in the Application Support folder). These bundles will contain template information for the data the application handles. I've constructed a bundle, with extension "booksprintstyle", and the directory structure is up to spec. I have an Info.plist all set and I think I've filled in all the values I need to. Do I need to change something in my App to have these folders-with-extensions recognized as bundle files, or am I missing something in my bundle structure? I noticed that some bundles have a file called PkgInfo; is that important?
Below is the Info.plist from my bundle.
<?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>English</string>
<key>CFBundleGetInfoString</key>
<string>1.0, Copyright © 2009 Joey Lange</string>
<key>CFBundleIdentifier</key>
<string>net.atherial.books.exporter.printingpress.printstyle</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Books Print Style - Generic</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleDisplayName</key>
<string>Books Print Style - Generic</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2009 Joey Lange</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
Do I need to change something in my App to have these folders-with-extensions recognized as bundle files…
Yes. Export a UTI declaration in your app's Info.plist for the type of these bundles. You'll declare the UTI as conforming to com.apple.package. See Understanding Uniform Type Identifiers for more.
Below is the Info.plist from my bundle.
That isn't relevant. The necessary declaration goes in your application bundle, not your document/plug-in bundles.
I noticed that some bundles have a file called PkgInfo; is that important?
No.
Related
In an iOS app built by colleagues of mine, some files are generated and put in an iCloud container.
Now I am tasked to get hold of these files from some service running on the backend.
If necessary on a Mac Mini installed in our server room.
I am a C# developer so I prefer the dotnet way, which should be entirely possible with net6.0.
dotnet new console
on My MacBook creates the Hello World! sample, which runs great on macOS.
To access files from iCloud containers, I need the NSFileManager.DefaultManager from the Foundation namespace.
This can be achieved in one of two ways AFAIK.
Microsoft.MacOS by changing the <TargetFramework> from net6.0 to net6.0-macos, or
Xamarin.Mac by including a reference to
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/64bits/full/Xamarin.Mac.dll
In either case, I need to add an Info.plist file to the project.
Using the 1st approach, the console app crashes without the console ever showing 'Hello World!'
The latter approach does show 'Hello World!', but then throws an exception:
System.ArgumentNullException: Value cannot be null.
at System.Threading.Monitor.ReliableEnter(Object obj, Boolean& lockTaken)
at System.Threading.Monitor.Enter(Object obj, Boolean& lockTaken)
at ObjCRuntime.Runtime.TryGetNSObject(IntPtr ptr, Boolean evenInFinalizerQueue) in /Library/Frameworks/Xamarin.Mac.framework/Versions/8.12.0.2/src/Xamarin.Mac/ObjCRuntime/Runtime.cs:line 1374
at ObjCRuntime.Runtime.GetNSObject[T](IntPtr ptr) in /Library/Frameworks/Xamarin.Mac.framework/Versions/8.12.0.2/src/Xamarin.Mac/ObjCRuntime/Runtime.cs:line 1426
at Foundation.NSFileManager.get_DefaultManager() in /Library/Frameworks/Xamarin.Mac.framework/Versions/8.12.0.2/src/Xamarin.Mac/Foundation/NSFileManager.g.cs:line 1165
at Program.<Main>$(String[] args) in /Users/sbc/Projects/Console1/Program.cs:line 8
I am new to dotnet on Mac and would rather avoid it, but if it is the only way to get to files from an iCloud container, it might be the way to go.
Here is my project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<Selfcontained>true</Selfcontained>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Reference Include="Xamarin.Mac.dll">
<HintPath>/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/64bits/full/Xamarin.Mac.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Here is my Program.cs:
// See https://aka.ms/new-console-template for more information
using Foundation;
Console.WriteLine("Hello, World!");
try
{
var manager = NSFileManager.DefaultManager;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Here is 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>CFBundleName</key>
<string>.NET 6 Console Mac Sample</string>
<key>CFBundleIdentifier</key>
<string>com.mycompany.console1</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>12.3</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>MyCompany</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>StarCommissioning</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</plist>
Today I was looking to make an archive in Xcode 12 and suddenly I can no longer see the Archives in Window -> Organizer (it will not open automatically as supposed). It will show me the alert with Build Succeeded but no archive to upload on Test Flight. I was looking in ~Library/Developer/Xcode/Archives and is there but I can't see it in Organizer.
Any reason and maybe a solution for this?
Make sure you have the correct app selected. For example, this app I have no archives shown:
But once I select the correct app, it works:
I have managed to find a solution for this. So I was using react native mapbox package which seem to have some pods issues as per this thread https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-770064084
Looks like the archive was malformed
Try the follow:
1 - Close XCode.
2 - Go to /Library/Developer/XCode/Archives.
3 - Find the .xarchive file that you just archived.
4 - Delete the folders that are not the targets that you just archived (if exist):
Products/Applications/your-app-dev.app
Products/Applications/your-app-stage.app
5 - Open the Info.plist file (still from the .xarchive file).
6 - Complete the file with the part that is missing:
<?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>ApplicationProperties</key>
<dict>
<key>ApplicationPath</key>
<string>Applications/your-app.app</string>
<key>Architectures</key>
<array>
<string>arm64</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.your-app.app</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<key>CFBundleVersion</key>
<string>42</string>
<key>SigningIdentity</key>
<string>Apple Development: Your Name (SOMEKEY123)</string>
<key>Team</key>
<string>123456789</string>
</dict>
<key>ArchiveVersion</key>
<integer>2</integer>
<key>CreationDate</key>
<date>2021-05-16T00:28:17Z</date>
<key>Name</key>
<string>your-app</string>
<key>SchemeName</key>
<string>your-app</string>
</dict>
</plist>
I've changed my version in pubspec.yaml to 1.0.1+1 (from 1.0.0+3)
flutter clean
flutter build ios
When I open [project]/ios/Runner.xcworkspace it still shows me 1.0.0 version.
What am I doing wrong? How can I force Xcode to update my version from CLI or pubspec.yaml?
This is how my Info.plist looks 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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>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>Sundee</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<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/>
</dict>
</plist>
The same thing happened to me.
I think that when I used the xcode interface he changed the file ios/Runner.xcodeproj/project.pbxproj and he didn't get the value automatically
I solved it like this.
change this:
CURRENT_PROJECT_VERSION = your buildnumber
MARKETING_VERSION = your version
to:
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
this appears 3 times
I got it. It's because my lines in my Info.plist did not look like the following:
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
Anyone has an idea why I had $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION)?
In my case, I had different flavors for my app, which I kind of understand to be schemes in XCode.
After doing flutter clean, since my app was done almost a year ago, I also decided to remove the android and ios folders to start from scratch, even the custom configurations. After that, I did pod install by setting my configurations to None first.
And then I encountered the issue. I did all the above solutions but didn't really work.
Turns out doing pod install set the Runner targets' build configs to Pods-Runner.<flavor>. I was able to have it update again after setting it to the Generated.xcconfig file.
before
after
I decided to set the Project config to the generated Pods-Runner.<flavor>, though I'm still not quite sure why, just felt like it was generated for a reason. Anyone who could help would be greatly appreciated.
#louise's answer got me pretty close but, weirdly, mine was the exact opposite. My Configurations look like this:
You need also get package.
CFBundleShortVersionString is the public "name" of the version (example: "2.5", or "3.8.1"). You must increase it at each release.
CFBundleVersion is the private build number. It is not seen on the AppStore. You must increase it at each upload. It means that if you ever reject a binary before it goes online, and you want to upload a new binary, it will have the same
CFBundleShortVersionString but must have a higher CFBundleVersion (example: public "2.5", private "2.5", and then binary reject, and re-upload private "2.5.1")
To achieve this, you have to add some values in CfBundleVersionShortString
Like:
<key>CFBundleShortVersionString</key>
<string>1.0</string>
And give the build value in Runner as 1.0 and version as 1.0
I have a MacOS app bundle bare bones working. That is, it runs the executable, that's it. Icon still isn't working even though I have an MyApp.icns file I can visually see in Finder. And i18n isn't working.
MyApp.app/
Contents/
Info.plist
MacOS/
MyApp # executable
Resources/
MyApp.icns
en.lproj
InfoPlist.strings
jp.lproj
InfoPlist.strings
The .icns I generated from here:
mkdir MyIcon.iconset
sips -z 16 16 foo.png --out MyIcon.iconset/icon_16x16.png
sips -z 32 32 foo.png --out MyIcon.iconset/icon_16x16#2x.png
sips -z 32 32 foo.png --out MyIcon.iconset/icon_32x32.png
sips -z 64 64 foo.png --out MyIcon.iconset/icon_32x32#2x.png
sips -z 128 128 foo.png --out MyIcon.iconset/icon_128x128.png
sips -z 256 256 foo.png --out MyIcon.iconset/icon_128x128#2x.png
sips -z 256 256 foo.png --out MyIcon.iconset/icon_256x256.png
sips -z 512 512 foo.png --out MyIcon.iconset/icon_256x256#2x.png
sips -z 512 512 foo.png --out MyIcon.iconset/icon_512x512.png
cp Icon1024.png MyIcon.iconset/icon_512x512#2x.png
iconutil -c icns MyIcon.iconset
rm -R MyIcon.iconset
My Info.plist is 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>en</string>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundleDisplayName</key>
<string>MyApp</string>
<key>CFBundleIdentifier</key>
<string>MyApp</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>MyApp</string>
<key>CFBundleExecutable</key>
<string>this/has/no/effect</string>
<key>CFBundleIconFile</key>
<string>NeitherDoesThis</string>
</dict>
The InfoPlist.strings for each language looks like this:
CFBundleDisplayName = "Foo";
NSHumanReadableCopyright = "Copyright © 2019 Me.";
or:
CFBundleDisplayName = "ふ";
NSHumanReadableCopyright = "著作権法 © 2019 目.";
The problems I'm having are:
I can't specify the executable path, it only works if it is named the same as MyApp.app, so MyApp executable.
The icon MyApp.icns isn't rendering in the /Applications folder (which is the only place I've put it so far). I'm not sure if I can customize that path either.
I'm not sure how to test if i18n works.
Wondering if one could verify that stuff, and show how to test the other things. Specifically:
Verify that you can't actually customize the path of the executable, it must be named the same as the app in the MacOS folder.
Verify that you must name the icon the same as the app, with .icns extension. I'm not sure this is true because for example Skypes main Icon is in the Resources/Skype Blue.icns location, and they say Skype Blue in the Info.plist. Wondering why I can't get this working.
How to test that i18n works. Wondering if I just change the Mac system language and open the app again, etc.
This is all without using XCode.
In the Info.plist missing/incorrect keys/strings can affect the first two concerns; if keys are duplicated, missing, or set incorrectly it can certainly cause issues with functionality.
Missing
NSPrincipalClass
CFBundleInfoDictionaryVersion
CFBundleSupportedPlatforms
CFBundlePackageType
CFBundleExecutable (this is the binary inside MacOS folder)
CFBundleLocalizations (optional)
DTXcode (optional)
DTPlatform (optional)
DTSDK (optional)
DTCompiler (optional)
Incorrect
CFBundleIdentifier (should be in reverse DNS format)
CFBundleVersion (duplicate/incorrect)
CFBundleSignature (incorrect)
NOTES: The application name MyApp.app does not need to be the same as the executable file inside the MacOS folder as long as you've added and set the key CFBundleExecutable. The application icon can be any name you want as well, the key to having it work is by including the additional CoreFoundation keys shown above set correctly.
Once you've got all the missing/incorrect keys sorted you should end up with something similar to:
<?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>MyApp</string>
<key>CFBundleIconFile</key>
<string>MyIcon</string>
<key>CFBundleIdentifier</key>
<string>com.company.MyApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>MyApp</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>10B61</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>18B71</string>
<key>DTSDKName</key>
<string>macosx10.14</string>
<key>DTXcode</key>
<string>1010</string>
<key>DTXcodeBuild</key>
<string>10B61</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 MyApp. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
*The Info.plist above should work with your app, as the values are set to what you've shown in your question.
Regarding i18n testing — the Internationalization and Localization Guide the sections Testing Your Internationalized App and Managing Strings Files Yourself should be helpful. There's a huge amount of information within the Guide; a one size fits all approach to testing usually won't do so you'll want to find what works best for you.
→ Information Property List Key Reference → About
Internationalization and Localization
error: redefinition of 'Category' as different kind of symbol
I have an NSManagedObject Class Problem, where my Class (Category) redefines a Class in Foundation, it seems, but Foundation is in both apps in same project!
My Project has two Targets, both of these Mac OS x apps share a DataModel and the Class in question. One app, the main app, is headed hopefully to the app Store
the other is a utility app to generate an sqlite database from XML for shipment with the main app.
The main app compiles and runs. The utility app throws the error a bit below here.
I am stump as to while this "Redefinition" problem occurs in the utility app only. A renaming of the Class Category, is a fix for this problem, but the fact
that the main app compiles and runs, tells me I could fix it by looking elsewhere.
I hope this is enough data for someone to tell me where to look.
$(TARGET_NAME) == SqlFromXml_HM == Product Name
The problem utility has:
0 Target Dependencies
11 Compile Sources
0 Link Binary With Libraries
5 Copy Bundle Resources
In file included from /Users/mbarron/Cocoa/iHungryMac386/SqliteFromXml_HM/AppDelegateSql.m:13:
/Users/mbarron/Cocoa/iHungryMac386/Classes/Category.h:14:12: error: redefinition of 'Category' as different kind of symbol
#interface Category : NSManagedObject {
^
In module 'Foundation' imported from /Users/mbarron/Cocoa/iHungryMac386/SqliteFromXml_HM/XmlListReader5.h:12:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15:
In module 'os' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/dispatch/dispatch.h:48:
In module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/os/object.h:74:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/objc/runtime.h:50:31: note: previous definition is here
typedef struct objc_category *Category;
^
1 error generated.
Info.plist follows:
<?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>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.DrummingGrouse.$(PRODUCT_NAME:rfc1034identifier)</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>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Category.h begins
// Category.h
#import <CoreData/CoreData.h>
#class Recipe;
#interface Category : NSManagedObject {
...
}
Many thanks for reading this. Mark
Don't call your interface Category. That name is used by the ObjC runtime.
Call it something more specific, like RecipeCategory.