question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-public API usage - The app references non-public symbols: _ffi_*

See original GitHub issue

Versions

  • Python : 3.8
  • MacOS version : 10.15.7
  • XCode Version : 12.0.1
  • Cython version : 0.29.17

Describe the bug

My app runs fine on the simulators and on a device, but when I archive the project and distribute it to App Store Connect I receive an email from Apple saying that my app has been rejected. The email reads:

ITMS-90338: Non-public API usage - The app references non-public symbols in ccc-graphs-12: _ffi_call, _ffi_closure_alloc, _ffi_closure_free, _ffi_prep_cif, _ffi_prep_closure_loc, _ffi_type_double, _ffi_type_float, _ffi_type_pointer, _ffi_type_sint16, _ffi_type_sint32, _ffi_type_sint64, _ffi_type_sint8, _ffi_type_uint16, _ffi_type_uint32, _ffi_type_uint64, _ffi_type_uint8, _ffi_type_void. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/

To Reproduce

  1. Install the toolchain and create an Xcode project.
  2. In the Xcode project: Build Phases --> Run Script add “-O --no-perms”
  3. Resolve warnings (use Xcode recommended updates). This includes changing the architecture to “Standard architecture” and migrating deprecated languages – NOTE. This step is not necessary! The exact same issue is reproduced without this step.
  4. Add an icon image set to app.
  5. In Signings & Capabilities configure the Team and Bundle Identifier.
  6. In Sources --> main.m change #include "Python.h" to an absolute path, i.e. "/path/to/kivy-ios/dist/root/python3/include/python3.8/Python.h" as is explained here.
  7. In the <yourapp>-Info.plist file specify why you need the camera or that you don’t use it, as is explained here.
  8. In General select “Requires full screen”

At this point, the project should be ready to upload. Build for “Any iOS Device” and click on Products --> Archive. After going through all the steps in the archive window, I am shown a message saying that the upload has been successful. This is shortly followed by the aforementioned rejection email.

Logs

No logs provided. However, the following may be of use:

Running toolchain status returns:

audiostream  - Not built
click        - Not built
curly        - Not built
cymunk       - Not built
distribute   - Not built
ffmpeg       - Not built
ffpyplayer   - Not built
flask        - Not built
freetype     - Build OK (built at 2020-12-09 20:02:24.391901)
host_setuptools - Not built
host_setuptools3 - Build OK (built at 2020-12-09 20:15:39.468316)
hostlibffi   - Build OK (built at 2020-12-09 20:02:48.271488)
hostopenssl  - Build OK (built at 2020-12-09 20:04:16.254736)
hostpython3  - Build OK (built at 2020-12-09 20:13:40.614943)
ios          - Build OK (built at 2020-12-09 20:22:42.687770)
itsdangerous - Not built
jinja2       - Not built
kivent_core  - Not built
kivy         - Build OK (built at 2020-12-09 20:29:01.150111)
libcurl      - Not built
libffi       - Build OK (built at 2020-12-09 20:06:13.337783)
libjpeg      - Not built
libpng       - Not built
libzbar      - Not built
markupsafe   - Not built
netifaces    - Not built
numpy        - Not built
openssl      - Build OK (built at 2020-12-09 20:08:59.288718)
photolibrary - Not built
pil          - Not built
pillow       - Not built
pkgresources - Not built
plyer        - Not built
pycrypto     - Not built
pykka        - Not built
pyobjus      - Build OK (built at 2020-12-09 20:23:58.339146)
python3      - Build OK (built at 2020-12-09 20:22:21.701912)
pyyaml       - Not built
sdl2         - Build OK (built at 2020-12-09 20:10:14.409268)
sdl2_image   - Build OK (built at 2020-12-09 20:14:17.752407)
sdl2_mixer   - Build OK (built at 2020-12-09 20:15:23.982876)
sdl2_ttf     - Build OK (built at 2020-12-09 20:15:35.183602)
werkzeug     - Not built
zbarlight    - Not built

Additionally, following the steps listed here, I navigated to the archive I uploaded to Apple and I ran the following commands in the terminal:

nm <App Name> | grep ffi_call nm <App Name> | grep ffi_closure_alloc nm <App Name> | grep ffi_closure_free

etc.

The only only unique output of the above commands was that for nm <App Name> | grep ffi_call which returned:

0000000100d1a2ea s ___pyx_k_pointer_before_ffi_call
U _ffi_call

The remaining command all returned U _ffi_closure_alloc etc.

Additional information

You can find Apple’s private API here.

Things I have tried in vain:

  • Build an Xcode project without libffi and hostlibffi. This just causes the app to crash.
  • Unlinking ffilib.a from the project. This is interesting, more on this below.
  • Searching for _ffi_ in the kivy-ios folder and deleting all the files that came up. This did nothing.
  • Wrote a program that systematically changes _ffi_call to __ffi_call, etc. in all the kivy-ios files. This didn’t make a difference. To be he honest, I don’t know why I ever thought this would work.

Unlinking ffilib.a from the project

Now doing so causes the build to fail on the simulators, but the errors I receive are:

Screenshot 2020-12-11 at 18 11 15

This makes me think that the error lies with the libffi.a static library, though I can’t be too sure.

Anyway, thanks for taking the time out to read this. I am at the end of my wits, so any insight into the problem or suggestion - seriously anything at all - is hugely appreciated.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:40 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
misl6commented, Jan 16, 2021

The process is pretty the same as building kivy-ios on top of master.

Given that you have successfully cloned the kivy-ios repo via git clone https://github.com/kivy/kivy-ios.git, inside the kivy-ios folder you have to launch the two following commands:

git fetch origin pull/582/head:test-pr-582 git checkout test-pr-582

In order to be sure that you did it right, a git log should show “Fixes header and library search paths on Release” as the topmost commit.

If it’s ok, then you can start by creating the venv and continue to follow the standard procedure.

As mentioned here, you can avoid doing the following steps thanks to this PR:

Uhm, the headers that were not found + the Debug/Release thing ringed the bell. Thank you @nikosgrikos for finding the workaround.

Can you please try this PR(#582) and check if all the process works flawlessly? When using this PR over master you should be able to avoid the following steps:

  • In “Build Settings > Architectures” add “arm64” to “excluded architectures”
  • In “main.m” file, line 8, change #include "Python.h” to #include “/path/to/folder/kivy-ios/dist/root/python3/include/python3.8/Python.h”
  • In “pystate.h” file, line 9, change #include "cpython/initconfig.h” to #include “/path/to/folder/kivy-ios/dist/root/python3/include/python3.8/cpython/initconfig.h”

At the end of the test, you can revert to the repo master by doing git checkout master inside the kivy-ios folder.

1reaction
nikosgrikoscommented, Jan 16, 2021

Same here. I am a newbie.

On Thu, 31 Dec 2020 12:09 pm Mirko, notifications@github.com wrote:

@nikosgrikos https://github.com/nikosgrikos Can you also please try to write down a step by step guide on how to reproduce your issue? Have you changed anything into the xcode project settings?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kivy/kivy-ios/issues/572#issuecomment-752912841, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASF25RS4FB7BETHGG7HLAI3SXREURANCNFSM4UXBDVHA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

False Alert of non-public symbols … | Apple Developer Forums
framework, the message appears to be a false alarm. Correct? ITMS-90338: Non-public API usage - The app references non-public symbols in Contents/Frameworks/ ...
Read more >
Non-public API usage: The app references non-public symbols
I am using react-native to build iOS app. I have successfully uploaded the app to app store but itunes sent me this email,...
Read more >
Developers - Non-public API usage - The app references non-public ...
Non-public API usage - The app references non-public symbols : _ffi_* · Python : 3.8 · MacOS version : 10.15.7 · XCode Version...
Read more >
iOS Question Non-public API usage - The app references non ...
I tried to store a new version of my app to Apple Store. I updated my last version with i-tunes connect by B4I...
Read more >
FFI - The Rustonomicon
Foreign Function Interface. Introduction. This guide will use the snappy compression/decompression library as an introduction to writing bindings for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found