@adasiko, first test whether you printer works on the Raspberry Pi. Print a file from a terminal on the Pi or print a test page from the Pi’s CUPS web interface. Make sure that your Pi shares the printer (CUPS must share printers in general and each printer needs to be shared individually). Probably this works already, your iPhone talking with the CUPS of the RaspBerry Pi. AirPrint as a server works on Ubuntu’s CUPS already for several years (as distro patch as CUPS upstream was maintained by Apple) but this support was rather rudimentary, not allowing to set options on the iPhone. Newer CUPS (2.4.x) which is maintained by OpenPrinting and not by Apple has full AirPrint support (for example the CUPS Snap).
If the Pi and your client machine running the CUPS Snap are in the same subnet, the CUPS Snap should see the printers on the Pi and automatically create a queue.
Your manual queue should principally work, the problem you mention seems to be a DNS problem. Can you log into the Pi via ssh ubuntu.local? Does a browser on your client display the Pi’s web interface via http://ubuntu.local:631/?
Clean Ubuntu Desktop installation with DEB CUPS - all works fine.
ping ubuntu.local - OK (It’s print server on Raspberry Pi)
Turn Off DEB CUPS services. Install SNAP CUPS. Add Printer from Web interface (it’s discovering fine with ubuntu.local name). Printing does not work - "Unable to locate printer “ubuntu.local”
ping ubuntu.local - OK
One line to /etc/hosts
And printing is working (without restart any services).
But ping is always working without problems… And original (DEB) CUPS working with it too…
adasiko@ubuntu20:~$ ping ubuntu.local -c 1
PING ubuntu.local (192.168.181.2) 56(84) bytes of data.
64 bytes from 192.168.181.2 (192.168.181.2): icmp_seq=1 ttl=64 time=0.470 ms
--- ubuntu.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.470/0.470/0.470/0.000 ms
adasiko@ubuntu20:~$ sudo snap run --shell cups.cupsd
root@ubuntu20:/home/adasiko# ipptool -tv ipp://ubuntu.local:631/printers/HP_LaserJet_Professional_P1102 get-printer-attributes.test
ipptool: Unable to connect to "ubuntu.local" on port 631 - Name or service not known
One line “192.168.181.2 ubuntu.local” in /etc/hosts and all works. But simple ping works without it…
@adasiko Could you check the syslog (/var/log/syslog file or journalctl command) whether at the point in time when ipptool had answered ipptool: Unable to connect to "ubuntu.local" on port 631 - Name or service not known to you, whether there are messages containing audit and DENIED? This way we could see whether the CUPS Snap’s security shield is blocking DNS.
If you cannot determine the exact time when you have issued the ipptool command, simply repeat the commands from above.