How to pop up system message box for iPhone?

Without hacking into dlls and created editor xcode patching scripts, and that whole world of nightmare pain… :slight_smile:

Is there an easier way to trigger an iphone system message box ?

How it could be possibel? Please help!

prime 31 plugins would help!! or u have to write ur own functions in xcode and import as a plugin http://unity3d.com/support/documentation/Manual/Plugins.html

I believe you gotta learn some Objective C.

1 Answer

1

Create a file called NativePopup.m and include it in your Assets, with this content:

#import <Foundation/Foundation.h>

void showNativeAlert( const char* title, const char* message)
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithUTF8String: title]
    message:[NSString stringWithUTF8String: message]
    delegate:nil
    cancelButtonTitle:@"OK"
    otherButtonTitles:nil];
    [alert show];
    [alert release];
}

Then include the code below in one of your Unity classes (C#) and you’ll be able to call the function showNativeAlert:

#if UNITY_IPHONE
	[DllImport("__Internal")]
	extern static public void showNativeAlert(string title, string message);
#endif

How'd you get the response back to Unity?