Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea update from 2.0, objective C addon updates

edited March 2015 in Questions Posts: 66

I have taken a several month break from Codea, but have finally gotten around to updating Acorn Mayhem, and want to upgrade Acorn Mayhem to the codea 2.1 (or now 2.3) runtime, and fixing support for the xcode addons.

I have 2 questions, where do I get the updated runtime, and how do I update my Xcode addons to match? I need to fix @Zoyt 's Sharing addon and In-App purchase addon.

Thanks, ~Patrick

EDIT: I tried following these instructions to update the runtime, and then these to update the addons, but when I started replacing CodeavViewController with StandaloneCodeaViewController I get numerous errors and am unsure if everywhere that says codeaviewcontroller needs replacing or just some of them. I needed to restore with time machine to get the game back to a working state. How do I update them properly?

Comments

  • Posts: 66

    Anyone????

    Progress report: I modified appdelegate.h, appdelegate.mm, iadsaddon.h, iadsadon.m, codeaaddon.h, codeaaddon.m, and standalonecodeaviewcontroller.h to match their equvalents in a freshly exported project, but need help with iapaddon.h/.m. in the meantime I tried to comment them out to test the rest of the code, but get errors in the freshly imported gamecenteraddon.m, saying "Implicit declaration of function 'luaL_setfuncs' is invalid in C99". I was surprised since this was copied straight from an exported project. what could be going wrong? What should I do?

    Thanks for any help.

    ~Patrick

  • SimeonSimeon Admin Mod
    Posts: 4,927

    Where is the code for iapaddon? Is it on github somewhere?

  • SimeonSimeon Admin Mod
    Posts: 4,927

    @pleiser all the header files in the <project>/Lua folder will need to be updated to the ones exported from a new project.

    My recommendation would be to do this the other way around: export a working version of your game from Codea 2.3, then add and fix the third-party addons.

  • Posts: 216

    @Simeon, here's the library thread, the github link doesn't seem to work anymore though.

    http://codea.io/talk/discussion/5098/objective-c-in-app-purchases-add-on
    
  • Posts: 216

    After some searching, there's a version of @Zoyts in app purchases library in the source code of his Stackit game on github.

    https://github.com/NathanFlurry/StackIt/tree/master/StackIt/Addons
    
  • edited March 2015 Posts: 66

    @Simeon, thanks, but after I copied over the header files from the /lua folder, I get several "Apple Mach-O Linker Error"s see this screenshot. what should I do?

    Also, I can't export a version of my game because pretty much half of the game was written after exporting to xcode.

    @Mr_Ninja, yes that is the correct library.

    Thanks, ~Patrick

    EDIT: I realised the script (under build phases> run script) was set to download version 2.0 of the runtime, I replaced it with the script from the freshly exported program. Now it downloaded the proper version of libtools and libcodea, and it builds sucessfully, but it crashes before it finishes running. according to the exception breakpoint it is failing when execution hits the line (in AppDelegate.mm)

    [self.window makeKeyAndVisible];
    

    , it gives the error message:"

     AcornMayhem[20865:7787230] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
    
    *** First throw call stack:
    (0x1824ca59c 0x1930380e4 0x1823b3290 0x1000b390c 0x1000d3afc 0x1000d10cc 0x100119580 0x186c79184 0x186c78e94 0x10011a040 0x10011b794 0x10011bffc 0x10014a2b4 0x10014a324 0x100156e80 0x186c79184 0x186c78e94 0x186c7f55c 0x186c7ccdc 0x186cedd24 0x1000b135c 0x186cea6f0 0x186f01688 0x186f03e08 0x186f024a0 0x18a70562c 0x182482a28 0x182481b30 0x182480154 0x1823ad0a4 0x186ce3aac 0x186cdeaa4 0x1000ad6d8 0x1936a6a08)
    
    libc++abi.dylib: terminating with uncaught exception of type NSException
    

    "

  • SimeonSimeon Admin Mod
    Posts: 4,927

    @pleiser but you could re-export your game and then copy the old <GameName.codea> folder into the newly exported project? That would ensure your Lua code is all up-to-date.

  • edited March 2015 Posts: 66

    I don't think I will do that right now, a lot of the changes were done in xcode, I want to keep it like this for now. any suggestions on how to fix this crash?

  • edited March 2015 Posts: 66

    I have tried splitting

     [self.window.makeKeyAndVisible];
    

    into

    [self.window makeKeyWindow];
    self.window.hidden = NO;
    

    It crashes on the second line. why is self.window.hidden = NO; making it crash?
    Any Sugestions???

    Edit: here is the code for appDelegate.h:


    // // AppDelegate.h // Acorn Mayhem // // Created by Patrick Leiser on Saturday, June 21, 2014 // Copyright (c) Patrick Leiser. All rights reserved. // #import <UIKit/UIKit.h> //#import "IAdsAddon.h" #import "IAPAddon.h" //#import "GameCenterAddOn.h" //#import "SharingAddOn.h" //inport nslog addon? @class StandaloneCodeaViewController; @interface AppDelegate : UIResponder <UIApplicationDelegate> //@property (strong, nonatomic) IAdsAddOn *iAdsAddon; //@property (strong, nonatomic) IAPAddOn *IAPAddOn; //@property (strong, nonatomic) GameCenterAddOn *gameCenterAddOn; //@property (strong, nonatomic) NsLogAddOn *NsLogAddOn; @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) StandaloneCodeaViewController *viewController; //@property (strong, nonatomic) SharingAddOn *sharingAddOn; @end

    here is appDelegate.mm:


    // AppDelegate.mm // Acorn Mayhem // // Created by Patrick Leiser on Saturday, June 21, 2014 // Copyright (c) Patrick Leiser. All rights reserved. // #import "AppDelegate.h" #import "StandaloneCodeaViewController.h" #import "iAdsAddon.h" #import "GameCenterAddOn.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; NSString* projectPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"AcornMayhem.codea"]; self.viewController = [[StandaloneCodeaViewController alloc] initWithProjectAtPath:projectPath]; //self.viewController = [[CodeaViewController alloc] init]; //iads addon //self.iAdsAddOn = [[IAdsAddOn alloc] init]; //[self.viewController registerAddon: self.iAdsAddOn]; // [self.viewController registerAddon:[iAdsAddon sharedInstance]]; // Create and add our GameCenterAddOn to Codea //self.gameCenterAddOn = [[GameCenterAddOn alloc] init]; //[self.viewController registerAddon: self.gameCenterAddOn]; // [self.viewController registerAddon:[GameCenterAddon sharedInstance]]; //self.IAPAddOn = [[IAPAddOn alloc] init]; //NSLog(@"should be initializng iapaddon"); //[self.viewController registerAddon:self.IAPAddOn]; // [self.viewController registerAddon:[NsLogAddOn sharedInstance]]; //self.sharingAddOn = [[SharingAddOn alloc] init]; //[self.viewController registerAddon:self.sharingAddOn]; //[self.viewController loadProjectAtPath:projectPath]; self.window.rootViewController = self.viewController; // [self.window makeKeyAndVisible]; [self.window makeKeyWindow]; //test // if (self.window.hidden==YES){ // NSLog(@"window is hidden"); //} self.window.hidden = NO; //test return YES; } - (void)applicationWillResignActive:(UIApplication *)application { } - (void)applicationDidEnterBackground:(UIApplication *)application { } - (void)applicationWillEnterForeground:(UIApplication *)application { } - (void)applicationDidBecomeActive:(UIApplication *)application { } - (void)applicationWillTerminate:(UIApplication *)application { } @end

    do you see any problems with these?

  • Posts: 66

    Also, it seems to be giving a more detailed call stack than it was earlier, here is the current error message:

    AcornMayhem[92361:9209931] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x00000001065a6a75 __exceptionPreprocess + 165
        1   libobjc.A.dylib                     0x000000010617ebb7 objc_exception_throw + 45
        2   CoreFoundation                      0x00000001064750ca -[__NSArrayM insertObject:atIndex:] + 954
        3   AcornMayhem                         0x000000010262d313 -[CodeaScriptExecute initWithCodeaContext:] + 450
        4   AcornMayhem                         0x000000010264ce30 -[CodeaGame setupLua] + 127
        5   AcornMayhem                         0x000000010264a164 -[CodeaGame initWithRenderer:andKeyboardView:inViewController:] + 436
        6   AcornMayhem                         0x000000010269960b -[ThreadedRuntimeViewController viewDidLoad] + 304
        7   UIKit                               0x0000000104b3c580 -[UIViewController loadViewIfRequired] + 738
        8   UIKit                               0x0000000104b3c77e -[UIViewController view] + 27
        9   AcornMayhem                         0x000000010269a0be -[ThreadedRuntimeViewController renderer] + 41
        10  AcornMayhem                         0x000000010269b730 -[ThreadedRuntimeViewController runBlock:] + 41
        11  AcornMayhem                         0x000000010269bf9a -[ThreadedRuntimeViewController setProject:] + 235
        12  AcornMayhem                         0x00000001026cce1e -[CodeaViewController loadProjectAtPath:] + 173
        13  AcornMayhem                         0x00000001026cce87 -[CodeaViewController runProjectAtPath:completion:] + 71
        14  AcornMayhem                         0x00000001026da586 -[StandaloneCodeaViewController viewDidLoad] + 175
        15  UIKit                               0x0000000104b3c580 -[UIViewController loadViewIfRequired] + 738
        16  UIKit                               0x0000000104b3c77e -[UIViewController view] + 27
        17  UIKit                               0x0000000104a5b509 -[UIWindow addRootViewControllerViewIfPossible] + 58
        18  UIKit                               0x0000000104a5b8a1 -[UIWindow _setHidden:forced:] + 247
        19  AcornMayhem                         0x000000010262ac97 -[AppDelegate application:didFinishLaunchingWithOptions:] + 1143
        20  UIKit                               0x0000000104a11458 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
        21  UIKit                               0x0000000104a12002 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2540
        22  UIKit                               0x0000000104a14e3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
        23  UIKit                               0x0000000104a13d35 -[UIApplication workspaceDidEndTransaction:] + 179
        24  FrontBoardServices                  0x0000000108aa1243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
        25  CoreFoundation                      0x00000001064dbc7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
        26  CoreFoundation                      0x00000001064d19c5 __CFRunLoopDoBlocks + 341
        27  CoreFoundation                      0x00000001064d1785 __CFRunLoopRun + 2389
        28  CoreFoundation                      0x00000001064d0bc6 CFRunLoopRunSpecific + 470
        29  UIKit                               0x0000000104a137a2 -[UIApplication _run] + 413
        30  UIKit                               0x0000000104a16580 UIApplicationMain + 1282
        31  AcornMayhem                         0x00000001026270f3 main + 115
        32  libdyld.dylib                       0x0000000106f0f145 start + 1
        33  ???                                 0x0000000000000001 0x0 + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    
    
  • Posts: 2,820

    @pleiser @Simeon - I'm a bit late, but I believe you're using my antiquated library. While none of my libraries have been updated for the new runtime, the most recent one is here: https://github.com/NathanFlurry/StackIt/blob/master/StackIt/Addons/IAPAddOn.m

  • edited April 2015 Posts: 216

    @Zoyt @ pleiser I have a version of the addon that I modified to the point that it doesn't spit out an error in Xcode. I'll share it, just not sure how I should share it since its in a folder with the rest of the easy iap classes.

    EDIT: Even though there are no errors, I still doubt it will work. The reason I can't test it is because Indont have a dev account.

Sign In or Register to comment.