Wintermute Engine > Development
Opening AppStore from WME Lite (iOS feature only)
(1/1)
metamorphium:
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)
--- Code: WME Script --- #ifdef __cplusplusextern "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
--- Code: WME Script ---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
--- Code: WME Script ---// 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. :)
Navigation
[0] Message Index
Go to full version