How to create a hosted content package without Xcode? - xcode

I was wondering if there is any other way to create a hosted content package for an in-app purchase without using X-Code.

We could use a terminal to do so, and we even don't need to create an in-app purchase using Xcode. Here are the steps.
1- Create a folder, let's call it "zzz"
2- Add your .plist file similar to the .plist file which the in-app purchase project created from Xcode would have generated, make sure to update the version and the product identifier fields.
3- Create a contents folder inside of it, and in the contents folder place your in-app purchase contents.
4- Open your terminal and write
productbuild --content "zzz" "zzz/nameOfPackage.pkg"
so basically after --content you write the full path of your folder, then the full path of where you want you package to be and the name of package.
I used this answer as reference Converting a xcodeproj in-app purchase to a pkg file from terminal (Bash) or how to convert a xcarchive file to a pkg file?

if you're referring to having a content bundle (i.e. a .zip file) with contents pertaining to your app, then yes.
I refer to the App Store Review Guidelines here from Apple themselves: (https://developer.apple.com/app-store/review/guidelines/)
IN terms of functionality, if the bundle downloads code in any way or form, your app will be rejected (Apple guidelines 2.7).
That's the main one that's mentions. Other than that, there's the general guidelines mentioned as per their website...

Related

How to create package file similar to Logic or Final Cut project

I am trying to create a file in OS X that is essentially a package that has files in it, similar to how a Logic project is a single file but contains all of the audio files within it (when you right-click the file it has the "Show Package Contents" option).
Doing this in Swift would be great, but also curious just in general how this is done? I haven't had much luck.
You need to define a "Document Package" type. Basically these "packages" are just a directory with a file extension applied that tells macOS to display them as a package. As long as you setup the type in your applications Info.plist then you shouldn't need any special API's to create the packages (though apple does have some helper APIs if you want to use them).
For complete documentation on defining a new "Document Package" type and some links to some helper API's see: https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/DocumentPackages/DocumentPackages.html

How to include support documents in xcode cocoa app?

In iOS version of app, sample/template files are added to Xcode in a group and then become a directory of that name within the app bundle. Easy enough.
What is the Cocoa equivalent? When I try the same thing, Xcode (Swift 3) fails on build with a "Command /usr/bin/codesign failed with exit code 1". How does one add support files (or directory of files) to a Cocoa app?
In macOS, I guess you mean that, every App creates a Resources Folder inside the NSBundle. Just check with right click "Show Bundle Content".
If you add resources to Xcode, just by dragging the file anywhere in your project navigation, will be asked to copy that file if needed.
I usually create a group with Supporting File, but thats arbitrary, because it has nothing to do with the file structure inside the project folder on disk nor with the product package.
To create groups just right mouse and select group.
This copies the file inside the Xcode project Folder. And if you choose to add target, then the file will be included to that Resource folder.
You can ask for that File with:
let bundle = Bundle.main
let path = bundle.path(forResource: "Test", ofType: "txt")
Edit
if you have to code sign your resources, then ope the copy files menu in Build Phases, add with the plus button your resource and check code sign on copy. This should provide a proper signing for your resource.
Hope it helps!

Archive recovery in xcode?

I recently used a system tool which removes 'junk' files to free space up. It deleted every single photo on my hard drive... My xcode code is present for an application I have but can I recover the lost app photos from an xcode archive which still exists? Many thanks, as I can't update my app anymore because of it.
If you can get the ipa that is a zip file, change the extension from .ipa to .zip and double-click to unzip.
That will produce a folder named Payload and in that folder is the app.
The app is a is a package, right click on it and "Show Package Contents".
All your images in the app will be there.
Additionally, if the images were added as Assets there will be an additional step to extract the images form the Assets.car file. See this SO Answer for extraction information.

How to install an OSX Automator workflow using „Packages“ installer

I want to use the OSX „Packages“ installer to install an Automator workflow, which uses an Obj-C Automator action.
The workflow had to be installed in the folder „Services", and the Obj-C action in the folder „Automator“, both in the user’s or system library.
Unfortunately, Packages shows only part of the existing file hierarchy:
Finder window:
Packages window:
Particularly Packages does not show the Automator folder, so that I cannot create the required payload.
In the docs I could not find a way to get access to the hidden folders.
Any suggestion how to create such an installer package is welcome.
My guess is that Packages is correctly trying to prevent you from installing something into /System/Library. In general, the contents of /System/Library is part of OS X itself and is managed by Apple. The correct place for user-installed system-wide items is in /Library.
In order to install something in the Library/Automator folder (and others that already exist or not), one has to do the following:
Activate in the Contents pane the Library line
Use the menu command Hierarchy/New Folder. This adds a new folder to Library in the Contents pane.
Rename it Automator.
Activate the new Automator line.
Use the + button to add a payload to the Automator folder.
Please note that the created installer will install the payload in an existing Automator folder. It will not replace an existing Automator folder with a new folder!

Adding preferences to Mac app

I have created a Mac app, now I want to add a Preferences to this. I looked up and came to know that I need to use NSPreferencePane. I have created a separate Xcode project for this and it will get generate a .prefPane file. On running this it will ask whether to add to system preferences or not and adds it if selected.
How can I bundle my app and preferences together ?
If I package this as a dmg file should I put both .app anf .prefPane file in the dmg file ?
It sounds like you want to magically (or programmatically) copy the preference pane into the right place (~/Library/PreferencePanes or /Library/PreferencePanes).
If you're going to copy it into your user's Preference Pane folder (i.e. ~/Library/PreferencePanes), you should be able to simply copy it from your Application bundle into there.
If you want to copy it into a system-wide Preference Pane folder (i.e. /Library/PreferencePanes), you'll need to write a privileged tool or helper app that gets Administrator priviledges so it can do the copy. Creating these things is not the most trivial of tasks.
If you are not distributing via the Apple App Store, you could use an installer package to install both your application and your preference pane. The newest option from Apple is "productbuild", which is a command line tool. PackageMaker is Apple's older tool for creating installers, and you can get it as part of the Auxillary Tools for Xcode, available from the Downloads section of developer.apple.com, and there are a bunch of other installer-building tools you could use to ship your Preference Pane with your app, such as "Iceberg".
It would be much easier to simply add the preferences interface to the app itself.

Resources