Create extensions that contain custom frameworks?

Max Finch

  • *
  • Posts: 2187
 
Code: [Select]
#include <Vungle.h>
#import <VungleSDK/VungleSDK.h>


using namespace vunglead;




namespace vunglead


{
    void startVungle(const char *appID)
    {
        VungleSDK* sdk = [VungleSDK sharedSDK];
        NSString * appID2 = [[NSString alloc] initWithUTF8String:appID];
        [sdk startWithAppId:appID2];
    }
   
    void playVungleAd()
    {
        VungleSDK* sdk = [VungleSDK sharedSDK];
        [sdk playAd:self];
    }
}
 

rob1221

  • *
  • Posts: 9474
It's not in a class, so "self" probably has nothing to refer to.  What type of object is "self" supposed to be?

Max Finch

  • *
  • Posts: 2187
I don't know I'm just trying to follow the extension on Vungles website while getting it to work with openfl  :(


I've attached my current progress so far if you want to take a look. It appears as though I've got the custom framework implemented since I don't get any troubles with it anymore. I'll keep working on this tomorrow I guess.

Max Finch

  • *
  • Posts: 2187
So I fixed up all the code and it builds fine. I'm getting errors on the .hx side but I looked in the xcodeproj file and I'm seeing the VungleSDK.framework in there! So that's good I guess

Max Finch

  • *
  • Posts: 2187
So now I'm getting an error

Code: [Select]
(openfl) ld: library not found for -llibz.1.dylib
Same thing when I tried importing libz.dylib, do you know how I would go importing a .dylib?

Max Finch

  • *
  • Posts: 2187
This is my include.xml file

Code: [Select]

<project>
    <dependency name="UIKit.framework" if="ios" />
    <dependency name="AdSupport.framework" if="ios" />
    <dependency name="AudioToolbox.framework" if="ios" />
    <dependency name="AVFoundation.framework" if="ios" />
    <dependency name="CFNetwork.framework" if="ios" />
    <dependency name="CoreGraphics.framework" if="ios" />
    <dependency name="CoreMedia.framework" if="ios" />
    <dependency name="Foundation.framework" if="ios" />
    <dependency name="libz.1.dylib" if="ios" /> <!-- Not sure if this works -->
    <dependency name="libsqlite3.dylib" if="ios" /> <!-- Not sure if this works -->
    <dependency name="MediaPlayer.framework" if="ios" />
    <dependency name="QuartzCore.framework" if="ios" />
    <dependency name="StoreKit.framework" if="ios" />
    <dependency name="SystemConfiguration.framework" if="ios" />
<dependency path="Extras/VungleSDK.framework" if="ios" />
    <ndll name="Vungle" if="ios"/>
</project>

rob1221

  • *
  • Posts: 9474
I don't know anything about dylibs.

Max Finch

  • *
  • Posts: 2187
Should I post the question in your old thread or new?

Just asked in the old thread since it kinda goes off your question

Max Finch

  • *
  • Posts: 2187
So Rob, I did some looking around, and to import dynamic libraries I came across this: https://groups.google.com/forum/#!topic/haxelang/tOTU6xZ5kis

More importantly:

Quote
or if you are referencing a ".dylib" file that already in system folder (like libz.1.2.5.dylib) just use the name without "lib" prefix and the version suffix.

<dependency name="z" if="ios" />

So now I'm here:

Code: [Select]
<project>
    <dependency name="UIKit.framework" if="ios" />
    <dependency name="AdSupport.framework" if="ios" />
    <dependency name="AudioToolbox.framework" if="ios" />
    <dependency name="AVFoundation.framework" if="ios" />
    <dependency name="CFNetwork.framework" if="ios" />
    <dependency name="CoreGraphics.framework" if="ios" />
    <dependency name="CoreMedia.framework" if="ios" />
    <dependency name="Foundation.framework" if="ios" />
    <dependency name="z" if="ios"/> <!-- Not sure if this works -->
    <dependency name="sqlite3" if="ios"/> <!-- Not sure if this works -->
    <dependency name="MediaPlayer.framework" if="ios" />
    <dependency name="QuartzCore.framework" if="ios" />
    <dependency name="StoreKit.framework" if="ios" />
    <dependency name="SystemConfiguration.framework" if="ios" />
   <dependency path="Extras/VungleSDK.framework" if="ios" />
    <ndll name="Vungle" if="ios"/>
</project>

But for some reason I'm still getting a build error:

Code: [Select]
Finished building for iOS.
[openfl] haxelib repository is now /Users/maxglockling/Desktop/Stencyl/plaf/haxe/lib/
[openfl] (2 failures)
[openfl]    Ld build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp normal arm64
[openfl]    Ld build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/armv7/Worp normal armv7
[openfl] The following build commands failed:
[openfl] ** BUILD FAILED **
[openfl] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[openfl] ld: symbol(s) not found for architecture arm64
[openfl]       _main in Main.o
[openfl]   "_Vungle_register_prims", referenced from:
[openfl] Undefined symbols for architecture arm64:

[openfl]  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch arm64 -dead_strip -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libGoogleAdMobAds.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libAdapterIAd.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libChartboost.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libGoogleAdMobAds.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libAdapterIAd.a -iphoneos_version_min 7.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -o /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp -L/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Release-iphoneos -L/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/arm64 -filelist /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp.LinkFileList -lstd -lregexp -llime -lads -lgamecenter -lnative -lpurchases -lrating -lmychartboost -lshare -lwebviewex -lVungle -lmyadmob -lChartboost -lz -lsqlite3 -lGoogleAdMobAds -lAdapterIAd -lApplicationMain -framework UIKit -framework OpenAL -framework OpenGLES -framework QuartzCore -framework CoreAudio -framework CoreGraphics -framework AudioToolbox -framework AVFoundation -framework Foundation -framework CoreMotion -framework MediaPlayer -framework iAd -framework GameKit -framework SystemConfiguration -framework StoreKit -framework AdSupport -framework CoreMedia -framework CoreData -framework UIKit -framework QuartzCore -framework OpenGLES -framework UIKit -framework UIKit -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreMedia -framework Foundation -framework MediaPlayer -framework QuartzCore -framework StoreKit -framework SystemConfiguration -framework VungleSDK -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CoreGraphics -framework CoreTelephony -framework EventKit -framework EventKitUI -framework MessageUI -framework StoreKit -framework SystemConfiguration -framework CoreLocation -framework MediaPlayer -framework Security -framework Social -dependency_info /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp_dependency_info.dat -framework Foundation -lobjc -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.ios.a -F/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Release-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk/System/Library/Frameworks -F/Users/maxglockling/stencylworks/engine-extensions/Vungle/Extras


[openfl] Thread model: posix
[openfl] Target: arm64-apple-darwin14.1.0
[openfl] Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
[openfl]     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -L/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Release-iphoneos -L/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/arm64 -F/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Release-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk/System/Library/Frameworks -F/Users/maxglockling/stencylworks/engine-extensions/Vungle/Extras -filelist /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp.LinkFileList -dead_strip -lstd -lregexp -llime -lads -lgamecenter -lnative -lpurchases -lrating -lmychartboost -lshare -lwebviewex -lVungle -lmyadmob -lChartboost -lz -lsqlite3 -lGoogleAdMobAds -lAdapterIAd -lApplicationMain -stdlib=libc++ -v -fobjc-arc -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libGoogleAdMobAds.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libAdapterIAd.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libChartboost.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libGoogleAdMobAds.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libAdapterIAd.a -miphoneos-version-min=7 -framework UIKit -framework OpenAL -framework OpenGLES -framework QuartzCore -framework CoreAudio -framework CoreGraphics -framework AudioToolbox -framework AVFoundation -framework Foundation -framework CoreMotion -framework MediaPlayer -framework iAd -framework GameKit -framework SystemConfiguration -framework StoreKit -framework AdSupport -framework CoreMedia -framework CoreData -framework UIKit -framework QuartzCore -framework OpenGLES -framework UIKit -framework UIKit -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreMedia -framework Foundation -framework MediaPlayer -framework QuartzCore -framework StoreKit -framework SystemConfiguration -framework VungleSDK -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CoreGraphics -framework CoreTelephony -framework EventKit -framework EventKitUI -framework MessageUI -framework StoreKit -framework SystemConfiguration -framework CoreLocation -framework MediaPlayer -framework Security -framework Social -Xlinker -dependency_info -Xlinker /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp_dependency_info.dat -o /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp


[openfl]     export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/maxglockling/Desktop/Stencyl/plaf/neko-mac:/Users/maxglockling/Desktop/Stencyl/plaf/haxe:/Users/maxglockling/Desktop/Stencyl/plaf:/usr/bin:/bin:/usr/sbin:/sbin"
[openfl]     export IPHONEOS_DEPLOYMENT_TARGET=7
[openfl]     cd /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios
[openfl] Ld build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/arm64/Worp normal arm64
[openfl] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[openfl] ld: symbol(s) not found for architecture armv7
[openfl]       _main in Main.o
[openfl]   "_Vungle_register_prims", referenced from:
[openfl] Undefined symbols for architecture armv7:


[openfl]  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch armv7 -dead_strip -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libGoogleAdMobAds.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libAdapterIAd.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libChartboost.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libGoogleAdMobAds.a -force_load /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7/libAdapterIAd.a -iphoneos_version_min 7.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -o /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/armv7/Worp -L/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Release-iphoneos -L/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/Worp/lib/armv7 -filelist /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/armv7/Worp.LinkFileList -lstd -lregexp -llime -lads -lgamecenter -lnative -lpurchases -lrating -lmychartboost -lshare -lwebviewex -lVungle -lmyadmob -lChartboost -lz -lsqlite3 -lGoogleAdMobAds -lAdapterIAd -lApplicationMain -framework UIKit -framework OpenAL -framework OpenGLES -framework QuartzCore -framework CoreAudio -framework CoreGraphics -framework AudioToolbox -framework AVFoundation -framework Foundation -framework CoreMotion -framework MediaPlayer -framework iAd -framework GameKit -framework SystemConfiguration -framework StoreKit -framework AdSupport -framework CoreMedia -framework CoreData -framework UIKit -framework QuartzCore -framework OpenGLES -framework UIKit -framework UIKit -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework CoreGraphics -framework CoreMedia -framework Foundation -framework MediaPlayer -framework QuartzCore -framework StoreKit -framework SystemConfiguration -framework VungleSDK -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CoreGraphics -framework CoreTelephony -framework EventKit -framework EventKitUI -framework MessageUI -framework StoreKit -framework SystemConfiguration -framework CoreLocation -framework MediaPlayer -framework Security -framework Social -dependency_info /Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Worp.build/Release-iphoneos/Worp.build/Objects-normal/armv7/Worp_dependency_info.dat -framework Foundation -lobjc -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.ios.a -F/Users/maxglockling/stencylworks/games-generated/Worp/Export/ios/build/Release-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk/System/Library/Frameworks -F/Users/maxglockling/stencylworks/engine-extensions/Vungle/Extras

[openfl] Thread model: posix
[openfl] Target: arm-apple-darwin14.1.0
[openfl] Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)

rob1221

  • *
  • Posts: 9474
Did you make the changes needed to support 64-bit?

Max Finch

  • *
  • Posts: 2187
oh haha let me check. . .

Max Finch

  • *
  • Posts: 2187
Yep it's all compiled right


Max Finch

  • *
  • Posts: 2187
Got it to build but it's crashing. Looking at the logs it seems to be because of that stupid dynamic library thing. I'm sorta at a loss with this.


« Last Edit: April 07, 2015, 04:37:36 pm by Max Glockling »

Max Finch

  • *
  • Posts: 2187
Rob this is my vungle.mm file. Learning objective c and c++ and I for sure consider myself a noob, but how does this look?


Code: [Select]
#include <Vungle.h>
#import <UIKit/UIKit.h>
#import <VungleSDK/VungleSDK.h>


using namespace vungle;


@interface VungleController : UIViewController
@end
namespace vungle


{
   
    VungleSDK* sdk = [VungleSDK sharedSDK];
    NSError *error;
    static VungleController *adController;
   
    //Start Vungle
    void startVungle(const char *appID)
    {
        if(adController == NULL)
        {
            adController = [[VungleController alloc] init];
        }
        NSString * appID2 = [[NSString alloc] initWithUTF8String:appID];
        [sdk startWithAppId:appID2];
    }
   
    //Play Vungle Ad
    void playVungle()
    {
        [sdk playAd:adController error:&error];
       
        if (error) {
            NSLog(@"Error encountered playing ad: %@", error);
        }
    }
}



rob1221

  • *
  • Posts: 9474
I'm not very good at Obj-C either.  If there's a syntax error then you'll see it when you run the build script.