Extension Creators : ios PLIST file

mdotedot

  • Posts: 1654
With the help of Justin and the internet (FaceBook Extension) I came up with a working way to add things to a PLIST file.

In my case I needed permission request for the microphone and that required setting key-string value in the PLIST file.

Because I don't want extension users to adjust their configuration it is better to include a custom plist template file.

You can use the {{app.file}} aproach but this is overwritten by the 'default'  later on:

Copying template file: /Users/admin/stencylworks/engine-extensions/MicroPhone/templates/ios/template/{{app.file}}-Info.plist -> Export/ios/_GAME_NAME_-Info.plist
Then a bit later on it will do:
Copying template file: /Users/admin/Downloads/plaf/haxe/lib/lime/lime/templates/ios/template/{{app.file}}/{{app.file}}-Info.plist -> Export/ios/_GAME_NAME_/_GAME_NAME_-Info.plist

But when you put the plist file in here with the PROJ name rather than {{app.file}} it works:

copy StencylApplicationDirectory/plaf/haxe/lib/lime/lime/templates/ios/template/{{app.file}}-Info.plist     to    (StencylWorks) engine-extensions/YourExtension/templates/iphone/PROJ/PROJ-Info.plist
Modify the (StencylWorks ) engine-extensions/YourExtension/templates/iphone/PROJ/PROJ-Info.plist to include your extension specific requirements.

In my case : add microphone permission request
Code: [Select]
<array>::foreach languages::
                <string>::__current__::</string>::end::
        </array>::end::
----
YOUR INFORMATION Like:
        <key>NSMicrophoneUsageDescription</key>
        <string>Need microphone access (M.E.)</string>
----
...
        <key>CFBundleDisplayName</key>



Then modify the include.xml (or nmml) for the ios section:
Code: [Select]
<section if="ios">
       
       
        <template path="templates" />

Resulting action:

Copying template file: /Users/admin/stencylworks/engine-extensions/MicroPhone/templates/iphone/PROJ/PROJ-Info.plist -> Export/ios/_GAME_NAME_//_GAME_NAME_-Info.plist

In the XCode project, under Resources, you can find the plist file containing the change.

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

GuyCockcroft

  • Posts: 193
I'm having a try with this at the moment. I've installed the microphone extension, and tried to build it using these modifications.
I've copied the  {{app.file}}-Info.plist from StencylApplicationDirectory/plaf/haxe/lib/lime/lime/templates/ios/template/
to
 /templates/iphone/PROJ/
(in the Microphone sub-folder in my engine-extensions folder)
I renamed the old plist file already in there and then renamed the {app.file}} one to PROJ-Info.plist   (is this correct??)

Then I added the code to allow the access to the mic to the bottom of this plist.
I looked for the include.xml file - (I'm assuming it's the one in the top level of the Microphone directory?) and saw that there was already a line about  setting the template path
        <template path="templates" />
Nevertheless, with or without this line, I get an error referencing a folder that doesn't exist on my computer (C:/Users/Justin....). (Errors pasted below...)

Please note that I'm not using Xcode at any time - just using a text editor (BBEdit) to modify the PLIST

I'd appreciate some help here - would be great to get this extension working properly!

Thanks.

jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/error.gif   false   ERROR   1557999588886005380   stencyl.sw.app.tasks.buildgame.GameBuilder   Failed: Running iOS. (Return code: 1)
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588875005378   stencyl.sw.util.StreamGobbler   [haxelib] Uncaught exception - Unexpected 'false'
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588875005377   stencyl.sw.util.StreamGobbler   [haxelib] Called from C:\Users\Justin\dev\eclipse\Stencyl\plaf\haxe-std\std/haxe/Template.hx line 86
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588875005376   stencyl.sw.util.StreamGobbler   [haxelib] Called from a C function
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588874005375   stencyl.sw.util.StreamGobbler   [haxelib] Called from C:\Users\Justin\dev\eclipse\Stencyl\plaf\haxe-std\std/haxe/Template.hx line 52
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588874005374   stencyl.sw.util.StreamGobbler   [haxelib] Called from hxp/System.hx line 240
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005373   stencyl.sw.util.StreamGobbler   [haxelib] Called from hxp/System.hx line 289
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005372   stencyl.sw.util.StreamGobbler   [haxelib] Called from a C function
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005371   stencyl.sw.util.StreamGobbler   [haxelib] Called from IOSPlatform.hx line 711
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005370   stencyl.sw.util.StreamGobbler   [haxelib] Called from lime/tools/PlatformTarget.hx line 109
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005369   stencyl.sw.util.StreamGobbler   [haxelib] Called from CommandLineTools.hx line 730
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005368   stencyl.sw.util.StreamGobbler   [haxelib] Called from CommandLineTools.hx line 146
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005367   stencyl.sw.util.StreamGobbler   [haxelib] Called from a C function
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005366   stencyl.sw.util.StreamGobbler   [haxelib] Called from CommandLineTools.hx line 25
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005365   stencyl.sw.util.StreamGobbler   [haxelib] Called from CommandLineTools.hx line 2084
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999588873005364   stencyl.sw.util.StreamGobbler   [haxelib] Called from ? line 1
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999587931005363   stencyl.sw.util.StreamGobbler   [haxelib] Running command: UPDATE
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999586895005362   stencyl.sw.util.StreamGobbler   [haxelib] Reading Lime config: /Users/guy_cockcroft/stencylworks/prefs/.lime_config.xml
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999586895005361   stencyl.sw.util.StreamGobbler   [haxelib] Using project file: project.xml
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999586895005360   stencyl.sw.util.StreamGobbler   [haxelib] Initializing project...
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999586894005359   stencyl.sw.util.StreamGobbler   [haxelib] OpenFL Command-Line Tools (8.7.0-LmSvzX)
jar:file:/Applications/Stencyl-full-b10331/sw.jar!/res/logview4j/images/info.gif   false   INFO   1557999585856005258   stencyl.sw.app.tasks.buildgame.GameBuilder   Building game with arguments: iOS, TESTING

mdotedot

  • Posts: 1654
You can only create iOS things with XCode on a Macintosh computer.

If you want to create an iOS extension you need to build it using command line execution code to use the compiler and linker.

The Android and iOS extensions that use native code you need ndll.

Look at this information:
http://www.stencyl.com/help/view/how-to-create-native-engine-extension/

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

GuyCockcroft

  • Posts: 193
Oh, yes. I'm on a mac. When I say "I don't use Xcode" I mean, I never export Xcode projects - just compile "inside" Stencyl.

GuyCockcroft

  • Posts: 193
Ah. Just realised I need to add the <template path="../../lime-templates" /> in the Advanced OpenFL settings page.

It's working now.