Error building for ios

Getting the following when trying to build for ios. Xcode 12.4.
Undefined symbols for architecture x86_64:
OBJC_CLASS$_ALAssetsLibrary”, referenced from:
objc-class-ref in background_upload.a(background_upload_API.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

The following build commands failed:
Ld /tmp/tmpcmYjNc/ios/app/build/Release-iphonesimulator/ForgeInspector.app/Forge normal
(1 failure)

ALAssets* symbols belong to Apple’s Assets Library framework which Apple have deprecated.

This means we’re no longer using it ourselves and have stopped linking the framework into the Forge runtime binary.

It’s possible to still add it manually via module/ios/build_steps.json:

{ "do": { "add_ios_system_framework": "AssetsLibrary.framework" } },

That said, depending on what you’re doing, there’s a good chance you’ll have to rewrite your module to use Apple’s PhotoKit framework instead.

The file module’s code might be a good starting point if you need to do that:

I don’t have a module/ios/build_steps.json file. I don’t even have a module folder. I created one in the root folder of my project with the one line you posted above? I’m still getting the same error.

Davids-MBP:ios davidbal$ pwd
/Users/davidbal/Workspace/angular-legacy/module/ios
Davids-MBP:ios davidbal$ more build_steps.json
{ “do”: { “add_ios_system_framework”: “AssetsLibrary.framework” } }

I’ve been reading https://trigger.io/docs/current/api/native_modules/native_build_steps.html. I don’t understand this note. What is the inspector project?

Note: After changing the build steps for either Android or iOS it is important to update the inspector project, any new build steps will be applied to the project to keep your development environment as close as possible to the final Forge build.”

module/ios/build_steps.json can be found in the source directory for a custom native module.

When you create a native module, it creates so-called “inspector” projects that you will need to open in Xcode and Android Studio to implement and test your native code.

You can find the documentation here: Native Modules

I’ll try to answer questions but native module development is quite hairy so we aren’t able to provide official support for it.

Is there a simpler way to solve the new error I’m getting?

OBJC_CLASS$_ALAssetsLibrary”, referenced from:
objc-class-ref in background_upload.a(background_upload_API.o)
ld: symbol(s) not found for architecture x86_64

I have a colleague that started with a newly wiped computer and installed xcode and forge. He’s getting the same _ALAssetsLibrary error. That suggests there is no conflict with older xcode versions, as I read in a different forum post about a similar problem.

I don’t see a module folder. Does that mean the project has no custom modules? I don’t know where _ALAssetsLibrary is being used if not in a custom module. Is it a necessary part of the project? Could facebook or pushwoosh require that library?

Here’s the config file for the project (with keys removed for security).

{
  "author": "leif.ullman@kidreports.com",
  "config_version": "4",
  "core": {
    "android": {
      "disable_ics_acceleration": true,
      "minimum_version": "21",
      "package_name": "com.kidreports.app.client"
    },
    "general": {
      "httpd" : {
        "port": 31929,
        "url": "https://localhost:31929/src/index.html",
        "certificate_path": "localhost.p12",
        "certificate_password": "kidreports"
      },
      "logging": {
        "level": "DEBUG"
      },
      "reload": true,
      "trusted_urls": [
        "https://secure.kidreports.com",
        "192.168.0.14"
      ],
      "reload_forcewifi": true
    },
    "ios": {
      "device_family": "any",
      "package_name": "com.kidreports.app.KidReports",
      "webview": "WKWebView",
      "disable_web_storage_backup": true
    }
  },
  "description": "KidReports Native Application",
  "homepage": "www.kidreports.com",
  "modules": {
    "share": {
      "version": "1.3"
    },
    "background_upload": {
      "version": "0.3.11"
    },
    "camera": {
      "version": "2.3"
    },
    "capture": {
      "version": "2.26",
      "config": {
        "usage_description": "View and Send Photos/Videos to attach to an activity stream"
      }
    },
    "contact": {
      "version": "2.12",
      "disabled": true
    },
    "damn_you_form_assist": {
      "version": "2.2"
    },
    "file": {
      "version": "2.25",
      "config": {
        "usage_description": "View and Send Photos/Videos to attach to an activity stream"
      }
    },
    "icons": {
      "config": {
        "android": {
          "48": "img/icons/kidreports-144x144.png",
          "72": "img/icons/kidreports-144x144.png",
          "96": "img/icons/kidreports-144x144.png",
          "144": "img/icons/kidreports-144x144.png",
          "192": "img/icons/kidreports-144x144.png"
        },
        "ios": {
          "57": "img/whiteBG/kidreports-57x57.png",
          "72": "img/whiteBG/kidreports-72x72.png",
          "76": "img/whiteBG/kidreports-76x76.png",
          "114": "img/whiteBG/kidreports-114x114.png",
          "120": "img/whiteBG/kidreports-120x120.png",
          "144": "img/whiteBG/kidreports-144x144.png",
          "152": "img/whiteBG/kidreports-152x152.png",
          "167": "img/whiteBG/kidreports-167x167.png",
          "180": "img/whiteBG/kidreports-180x180.png",
          "1024": "img/whiteBG/kidreports-1024x1024.png",
          "prerendered": true
        }
      },
      "version": "2.9"
    },
    "launchimage": {
      "config": {
        "ios": {
          "wC_hC": "img/launch/1334x750.png",
          "wR_hC": "img/launch/1920x1080.png",
          "wC_hR": "img/launch/1080x1920.png",
          "wR_hR": "img/launch/2732x2048.png"
        },
        "android": {
          "portrait": "img/launch/2048x1536.png",
          "landscape": "img/launch/1536x2048.png",
          "background-color": "#ffffff",
          "background-size": "auto"
        },
        "hide-manually": true
      },
      "version": "2.13"
    },
    "media": {
      "config": {},
      "version": "2.9"
    },
    "notification": {
      "version": "2.8"
    },
    "parameters": {
      "version": "2.0",
      "config": {
        "bumpme": "16",
        "PushwooshAppID": "removed"
      }
    },
    "prefs": {
      "version": "2.3"
    },
    "request": {
      "config": {
        "ats": [
          {
            "domain": "localhost",
            "NSExceptionAllowsInsecureHTTPLoads": true
          }
        ]
      },
      "version": "2.12"
    },
    "tabs": {
      "version": "3.7"
    },
    "ui": {
      "version": "2.1"
    },
    "flurry": {
      "version": "2.4",
      "config": {
        "debug": true,
        "ios_api_key": "removed",
        "android_api_key": "removed"
      },
      "disabled": true
    },
    "pgcapture": {
      "version": "0.2.25"
    },
    "urlhandler": {
      "version": "2.3",
      "config": {
        "scheme": "kidreports"
      }
    },
    "platform": {
      "version": "2.3"
    },
    "display": {
      "version": "2.14",
      "config": {
        "fullscreen": {
          "ios7": "no-statusbar"
        },
        "statusbar": {
          "ios": {
            "hidden": true,
            "transparent": true,
            "style": "default"
          }
        }
      }
    },
    "deviceinfo": {
      "version": "1.0.6"
    },
    "pushwoosh": {
      "version": "3.8.0"
    },
    "bolts": {
      "version": "1.9.0"
    },
    "oauth": {
      "version": "1.1",
      "config": {
        "redirect_scheme": "com.kidreports.oauth2",
        "providers": [
          {
            "name": "facebook",
            "client_id": "removed",
            "client_secret": "removed",
            "authorization_endpoint": "https://www.facebook.com/dialog/oauth",
            "token_endpoint": "https://graph.facebook.com/v2.10/oauth/access_token",
            "redirect_uri": "https://secure.kidreports.com/utils/oauth2redirect",
            "authorization_scope": "public_profile publish_actions"
          }
        ]
      }
    }
  },
  "name": "KidReports",
  "platform_version": "v2.9.2",
  "version": "2.12.18"
}

Just to run you through it from the top again :slight_smile:

  1. ALAssetsLibrary has been deprecated by Apple and therefore we are no longer linking it with the Forge runtime.
  2. The linker error you are getting is because one of your custom native modules is trying to use ALAssetsLibrary API’s.
  3. In the past this was not a problem because we were also using those API’s and therefore included ALAssetsLibrary with the main Forge runtime.
  4. Going by the error message given by the linker, the module causing the issues is most probably: background_upload
  5. You can verify whether this is the case by temporarily removing the module from your project and rebuilding.

To fix this you will need to:

  1. Track down the source code repository for your custom native module.
  2. Add the AssetsLibrary.framework to the build steps file as described earlier.
  3. Regenerate the inspector project.
  4. Rebuild and test the inspector project.
  5. (Potentially) Depending on what you’re doing you may need to rewrite your module to no longer use the functionality Apple has deprecated in ALAssetsLibrary API’s.
  6. Re-upload the module as described in the native module documentation.

Other options:

  1. Stop using your background_upload module.
  2. Contract us or someone else to bring your background_upload module up to date with Apple’s changes.

I haven’t been able to find the source code for the custom native module.

Does forge now support background uploading? If not, how do we go about updating the background_upload module?

I have tried 2 other approaches to get a successful build.

  1. Revert back to xCode 11 - result: not working forge is still trying to use xCode 12.2.
  2. Build iOS app on Linux following the instructions here: https://forge.readthedocs.io/en/v1.4/tools/ios-linux.html. This isn’t working either. I’m not following the instructions. forge build ios produces an error: File “/home/bal/TriggerToolkit/build-tools/forge/remote.py”, line 750, in build
    raise ForgeError(‘build failed: %s’ % build[‘log_output’])

Do you think either of those two approaches will work?