beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.65k stars 372 forks source link

Documentation is unclear that physical iOS devices aren't yet supported #1190

Open boxed opened 1 year ago

boxed commented 1 year ago

Describe the bug

I failed to test my app in the simulator (see #1189) so I tried running on device. I failed with this too and noticed the docs are... a bit weird.

Steps to reproduce

Ran briefcase run iOS -u -r -d <my UDID as copy pasted from XCodes devices list> Get the error message Invalid device device name '<UDID>'

Expected behavior

App installed and started on phone.

Screenshots

No response

Environment

Logs

No response

Additional context

I read through the code and it does look rather suspicious. It looks like it validates the device IDs against a list it gets from a function call get_simulators. But I'm not trying to run on a simulator, I'm trying to run on a real device...

The docs at https://docs.beeware.org/en/latest/tutorial/tutorial-5/iOS.html are rather weird about this. They show how to get something running on a simulator, but then at the end say "We’ve now got an application on our phone!". Which isn't what the commands above is doing or the text above talks about.

When I run just briefcase run iOS it shows a menu asking which simulator... but I don't want a simulator. I want the real phone.

rmartin16 commented 1 year ago

Crosslinking; may still be room for doc improvements, though:

boxed commented 1 year ago

Ah. Yea ok. Didn't find that when searching. Yea, the docs should definitely change! As of now they lie, and don't mention this workaround which is what you actually need.

boxed commented 1 year ago

Although. Now that I've tried to open xcode with briefcase open iOS and run that I see another problem:

from . import _bcrypt # noqa: I100 ImportError: dlopen(/private/var/containers/Bundle/Application/E0914435-ABEE-415F-B9AE-0F4AB42E3162/RebootShow.app/app_packages/bcrypt/_bcrypt.abi3.so, 0x0002): tried: '/usr/lib/system/introspection/_bcrypt.abi3.so' (no such file, not in dyld cache), '/private/var/containers/Bundle/Application/E0914435-ABEE-415F-B9AE-0F4AB42E3162/RebootShow.app/app_packages/bcrypt/_bcrypt.abi3.so' (mach-o file (/private/var/containers/Bundle/Application/E0914435-ABEE-415F-B9AE-0F4AB42E3162/RebootShow.app/app_packages/bcrypt/_bcrypt.abi3.so), but incompatible platform (have 'macOS', need 'iOS')), '/private/preboot/Cryptexes/OS/private/var/containers/Bundle/Application/E0914435-ABEE-415F-B9AE-0F4AB42E3162/RebootShow.app/app_packages/bcrypt/_bcrypt.abi3.so' (no such file), '/private/var/containers/Bundle/Application/E0914435-ABEE-415F-B9AE-0F4AB42E3162/RebootShow.app/app_packages/bcrypt/_bcrypt.abi3.so' (mach-o file (/private/var/containers/Bundle/Application/E0914435-ABEE-415F-B9AE-0F4AB42E3162/RebootShow.app/app_packages/bcrypt/_bcrypt.abi3.so), but incompatible platform (have 'macOS', need 'iOS'))

at least it finds the so file! :P

boxed commented 1 year ago

After debugging help for #1189, I got that to work by rm -rf build/ and now after that the error in xcode is:

[...] but incompatible platform (have 'iOS-sim', need 'iOS'))

There's clearly something fishy about the build folder! That the xcode project is IN the build folder seems less than ideal if I have to nuke it periodically. Maybe there should be build/iOS/simulator/, build/iOS/device/, etc?

Anyway, I tried nuking build/ again, and only ever building for the real phone, but no dice. Same error as above. Still... seems like there's a clue here somewhere...

sathishchinniah commented 9 months ago

@boxed I am also facing same issue. My custom framework is working fine in simulator. But not working in real device.

Below is my error. Any workaround or fixes you had for your issue ?

dyld[541]: Library not loaded: @rpath/CustomFramework.framework/CustomFramework
  Referenced from: <E072FE8A-611F-30AB-A6ED-186777B4B0F1> /private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/App
  Reason: tried: '/usr/lib/swift/CustomFramework.framework/CustomFramework' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/CustomFramework.framework/CustomFramework' (no such file), '/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework' (mach-o file (/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework' (mach-o file (/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework), but incompatible platform (have 'iOS-sim', need 'iOS')), '/usr/lib/swift/CustomFramework.framework/CustomFramework' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/CustomFramework.framework/CustomFramework' (no such file), '/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework' (mach-o file (/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework' (mach-o file (/private/var/containers/Bundle/Application/8B615D3F-B911-41DB-A630-F74C7737DAC4/App.app/Frameworks/CustomFramework.framework/CustomFramework), but incompatible platform (have 'iOS-sim', need 'iOS'))
mhsmith commented 9 months ago

Briefcase does not yet support running apps on a physical iOS device. There's a workaround in #860, but if you want to add custom frameworks then that's probably out of Briefcase's scope, and you should seek help in a more general iOS forum.

Let's keep this issue focused on improving the documentation.

freakboy3742 commented 9 months ago

We need to be clear that there's 2 issues being discussed here.

The first is starting apps on iOS devices from the Briefcase command line. This is a gap in documentation.

The second is adding external frameworks to your iOS app. I'd argue it is in scope for Briefcase - it's the manifestation of #485 on iOS/macOS, which is being addressed on Android by #1610 - but it is completely distinct from the subject of this ticket (launching on iOS devices).