[Fixed] extern "C" error

I’ve been trying to get native code working in my iphone game, I’ve downloaded the unity native code example and I’ve read the manual on native code. All I want is to fire off a method in Obj-C from C#

Here’s my Xcode:

extern "C" {
	void _StartStoreManager()
	{
		...
	}
}

but when I go to build it I get this error:

Expected identifier or ‘(’ before string constant

I’m an xcode noob so I’m probably missing something obvious

EDIT: Turns out I had to change the file extension to .mm

1 Like

try to rename the extension of the file with .mm and not .m

1 Like

Thanks, I knew it was something simple :slight_smile:

Now that it builds I need to sort out another error XD

It says:

Error from debugger: mi_cmd_stack_list_frames: Not enough frames in stack.

It was working fine before I added the MKStoreManager code

http://blog.mugunthkumar.com/coding/iphone-tutorial-–-in-app-purchases/

Maybe it doesn’t work with Unity?
More likely I’ve implemented it wrong some how

do you added the framework "StoreKit.framework ?

yes, that’s in there

This help me to solve problem.