Integration troubleshooting

When integrating your app with Setapp, you might meet one of these challenges. Please see how to overcome them quickly and efficiently.

How do I differentiate my Setapp users from my App Store users?

I see an error when using requestAuthorizationCodeWithClientID

Undefined symbols for architecture arm64

Can I send a request directly from my Mac app to the Setapp API endpoint?

My project uses only Objective-C (no Swift), and I see an auto-link error

I see an error while building an archive for submission to the App Store

How do I differentiate my Setapp users from my App Store users?

The user ID can be used as an identifier of Setapp origin for your Mac users. You can retrieve user ID only by integrating your app via Vendor API.

Use one of these to get a user ID:

  1. Get userinfo API endpoint. With this request, you will receive the user's ID, name, and email.
    Note: Name and email are only available if you integrated the app via "Sign in with Setapp".
  2. The user's ID can also be retrieved from the access token itself. An access token is a JSON Web Token (JWT), so the user ID can be found in a "sub" field.

I see an error when using requestAuthorizationCodeWithClientID

[[STPManager sharedInstance]
requestAuthorizationCodeWithClientID:@"<MY_OAUTH_CLIENT_ID>"
 scope:[NSArray arrayWithObject:@"application.access"]
 completionHandler:^(NSString * _Nullable result, NSError * _Nullable error) {
 
 	NSLog(@"result: %@", result);
 	NSLog(@"error: %@", error);
 
 }];

What if you applied the code above and got this error?

error: Setapp.XPCError(code: Setapp.XPCError.ErrorCode.unsupportedXPCServiceVersion, remoteObjectProxyType: Setapp.XPCServerConnectionChecker, underlyingError: nil, currentXPCAPIVersion: Optional(SemanticVersion(version: “0”)), requiredXPCAPIVersion: Optional(SemanticVersion(version: “2.9.8"))).

This could happen if the Setapp Framework wasn't ready to process the request. Try to cut out the code and paste it after the applicationDidFinishLaunching method.

Undefined symbols for architecture arm64

An error about undefined symbols might occur if you use a keyboard extension. In this case, you must also integrate the Setapp Framework into the extension.

Can I send a request directly from my Mac app to the Setapp API endpoint?

You need a back-end to call the Authorization Server of Setapp Vendor API. These requests include your app's secret key, which is visible to users. As soon as you receive an access token using the /token endpoint, you can make requests to the Resource Server of Setapp Vendor API directly from the client. These requests use only the access token for authorization that is specific to a particular user. To renew the access token, use the refresh token: send a request to the Authorization Server again from the back-end.

In a nutshell, you can only communicate with the Setapp Vendor API via the back end. All requests to the Authorization Server can be sent from the back-end, and all requests to the Resource Server can be safely sent from a client.

My project uses only Objective-C (no Swift), and I see an auto-link error

You can face an auto-link issue if your app uses only Objective-C and lacks a Swift codebase. See an example of such an error:

ld: warning: Could not find or use auto-linked library 'swiftCompatibility56': library 'swiftCompatibility56' not found  
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityConcurrency': library 'swiftCompatibilityConcurrency' not found  
ld: Undefined symbols:  
  **swift_FORCE_LOAD_$\_swiftCompatibility56, referenced from:  
      l5848 in libSetapp.a[arm64][2](libSetapp.a-arm64-master.o)  
  **swift_FORCE_LOAD_$\_swiftCompatibilityConcurrency, referenced from:  
      l5847 in libSetapp.a[arm64][2](libSetapp.a-arm64-master.o)  
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To fix the issue, make a 2-step change:

Step 1. Link the project to the Swift standard libraries. To do this, implement one of the following:

  • Add an empty Swift file to your project, and Xcode will automatically set the needed settings.
  • Manually apply these changes to the project config:
SWIFT_VERSION  = 5.0  
SWIFT_OPTIMIZATION_LEVEL = -0none  
OTHER_LDFLAGS = -L$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) -L/usr/lib/swift

Step 2. Embed Swift standard libraries to your project.

📘

Note

Apply this step only if the minimum supported version of your app is:

  • macOS 10.14 and earlier verisions
  • iOS 12 and earlier versions

Switch the flag to YES:

ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES

I see an error while building an archive for submission to the App Store

  • If you generate a build to submit it to the App Store and you see the following error:
    Build input file cannot be found: '/Users/sebakotiv/Library/Developer/Xcode/DerivedData/Timemator_iOS-fbydvetwfjbfrxfeklqginczlppb/Build/Products/Debug-iphoneos/libSetapp.a'.\

or

  • If you are facing build errors while integrating with CocoaPods,

Please use one of the following solutions:

  1. Build the CocoaPods target first, and then build your app.
  2. Add a Run Script build phase:
5613DEB12A9F367A00A105D5 /* Xcode 15 Beta Workaround */ = {
			isa = PBXShellScriptBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			inputFileListPaths = (
			);
			inputPaths = (
			);
			name = "Xcode 15 Beta Workaround";
			outputFileListPaths = (
			);
			outputPaths = (
				"${PODS_XCFRAMEWORKS_BUILD_DIR}/Setapp/libSetapp.a",
			);
			runOnlyForDeploymentPostprocessing = 0;
			shellPath = /bin/sh;
			shellScript = "# This prevents Xcode 15 Beta from failing with error \n# \"Build input file cannot be found: '…/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/Setapp/libSetapp.a'\".";
			showEnvVarsInLog = 0;
		};
  1. Use Xcode 14 instructions for Sonoma.
    We do not recommend removing the -force_load flag because it guarantees Setapp Framework early init and the stability we expect from it.