Hi muties,
WME lite has a built in capability of in-app purchases. However our publisher decided that they wanted to have two separate version when the lite would open the full version in app store for purchase. For that reason I had to do some modification to sources and I hope Mnemonic will add them to the main build. :wink: :wink:
Without much ado:
changes to ios_utils.h (bold)
#ifdef __cplusplus
extern "C" {
#endif
void IOS_GetDataDir(char* buffer);
void IOS_ShowStatusLine(int show);
void IOS_GetDeviceType(char* buffer);
void IOS_OpenAppleStore(char* ID); // this has been added by me
#ifdef __cplusplus
}
#endif
changes to ios_utils.m
void IOS_OpenAppleStore(char* ID)
{
NSString* nsId = [[NSString alloc] initWithCString: ID];
NSString* targetString = @"itms-apps://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=";
targetString = [[targetString stringByAppendingString: nsId] stringByAppendingString:@"&mt=8"];
[nsId release];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: targetString ]];
}
changes to AdGame.cpp
// this will need to be added to CAdGame::ScCallMethod if else blocks
else if (strcmp
(Name,
"OpenAppleStore") ==
0) { Stack->CorrectParams(1);
char* AppleStoreId = Stack->Pop()->GetString();
IOS_OpenAppleStore(AppleStoreId);
Stack->PushNULL();
return S_OK;
}
Also the same file needs to have:
#include "ios_utils.h"
at the top.
The usage in the actual scripts is simple:
Game.OpenAppleStore("123456789"); where the number is your application apple store id.
Hope this helps to someone.