iPad or MacBook

I have a customer who has bought my iPad app and is running it on a Mac. (sigh)
Some things are odd.
eg File browsing , (which is now mostly resolved by using iCloud style API calls)

The latest oddity is the use of MobileMessageBox
One of these has up to 8 items - acting as best it can as a popupmenu substitute.
However, on an iPad, the options are stacked in a vertical list, while on the Mac, they are presented as a horizontal list that doesnt fit in the screen.

Any suggestions for a better approach?

eg a better popupmenu substitute, or some way to force vertical stacking on a Mac, (or even at the worst case, some way to know that a Mac is being used?)

NSProcessInfo has an isMacCatalyst method. That should be able to tell.

Could you attach a screenshot of the dialog on the two platforms?

Mac:

iPad:
image

This is what I use to detect an iOS app running on Mac

Function isiOSAppOnMac() As Boolean
		  if getiOSVersion >= 14 then
		    //Detecting Apple silicon
		    declare function processInfo_ lib "Foundation" selector "processInfo" (clsRef as ptr) as ptr
		    declare function isiOSAppOnMac_ lib "Foundation" selector "isiOSAppOnMac" (obj_id as ptr) as Boolean
		    dim AppOnMac as boolean = isiOSAppOnMac_(processInfo_(NSClassFromString("NSProcessInfo")))
		    
		    
		    Return AppOnMac
		  end if
		End Function

And

Function getiOSVersion() As Double
		  
		  Static sSystemVersion As Double
		  
		  //Get sSystemVersion only once
		  If sSystemVersion = 0.0 Then
		    
		    Declare Function currentDevice_ Lib "UIKit" selector "currentDevice" (clsRef As ptr) As ptr
		    Declare Function systemversion_ Lib "UIKit" selector "systemVersion" (obj_id As ptr) As CFStringRef
		    Dim device As Ptr = currentDevice_(NSClassFromString("UIDevice"))
		    Dim systemVersion As String = systemversion_(device)
		    
		    Try
		      sSystemVersion = Double.FromString(systemVersion)
		    Catch
		    End Try
		    
		  End If
		  
		  Return sSystemVersion
		End Function
6 Likes

This design could be improved with a modal screen that presents all these options in a Table.

2 Likes

it also looks like there’s a plist entry that you can set to further customize the behavior of your app:

<key>LSRequiresIPhoneOS</key>
<false/>

This entry tells the app that it should run as a native macOS app (via Mac Catalyst).