App Closes/crashes Randomly

Discussion in 'Technical Discussion' started by bailey tucker, Aug 4, 2018.

Tags:
  1. bailey tucker

    bailey tucker Boxer

    Joined:
    Aug 4, 2018
    Messages:
    5
    Likes Received:
    0
    Hello my name is Bailey Tucker and I used buildbox to create the pixelated platformer game called: [Snake Run] which is currently on the app store. The game works perfectly except for when it crashes at random times which can happen on any screen: main menu, during game, game over etc.. I've read the forum posts about games crashing and I've optimized the atlases bringing it down to only 4 atlases I've also removed all unnecessary sound things. The game is 25.4 mb and I have updated to the most recent java. I Have no clue what could be the issue. It may be possible that the game only crashes on old iPhones because the only reports of crashes so far were from my friends Alan (iPhone 6s), Chase (iPhone 6), and myself (iPhone 6). I really want to get everyone at my school playing it when the school year starts (The monday after next monday) and a clean and bug free game would ideal if I want to impress my friends.

    As I said earlier the game is called " [Snake Run] "on the app store and its icon includes a king and 7 snakes on a cloudy background feel free to download the free game to get a better understanding of the crashes it should only take about 3-5 min to experience a crash (not that they happen periodically or anything).

    Thanks for reading this far and for helping!
     
  2. bailey tucker

    bailey tucker Boxer

    Joined:
    Aug 4, 2018
    Messages:
    5
    Likes Received:
    0
    I have found that the error was something called Thread 1: signal SIGABRT which has to do with outlets not being connected or something but I don't know what outlets are or how to fix this
     
  3. bailey tucker

    bailey tucker Boxer

    Joined:
    Aug 4, 2018
    Messages:
    5
    Likes Received:
    0
    here is the code


    //

    // GameViewController.m

    // BBPlayer

    //

    // Created by Nik Rudenko on 9/12/17.

    //

    //



    #import "GameViewController.h"

    #import <OpenGLES/ES2/glext.h>

    #import "PTModelController.h"

    #import "PTModelGeneralSettings.h"

    #import "PTPAppDelegate.h"

    #import "cocos2d.h"

    #import "PTPConfig.h"

    #include "PTPSettingsController.h"





    #define IOS_MAX_TOUCHES_COUNT 10



    static PTPAppDelegate s_sharedApplication;



    @interfaceGameViewController () {

    NSString* shareMessage;

    bool sheduledForShareWidget;

    }

    @property (strong, nonatomic) EAGLContext *context;



    @end



    @implementation GameViewController



    - (void)viewDidLoad{

    [superviewDidLoad];



    sheduledForShareWidget = false;

    self.context = [[EAGLContextalloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];



    if (!self.context) {

    NSLog(@"Failed to create ES context");

    }



    GLKView *view = (GLKView *)self.view;

    view.context = self.context;

    view.drawableDepthFormat = GLKViewDrawableDepthFormat24;

    [view setMultipleTouchEnabled: YES];



    [selfsetPreferredFramesPerSecond:60];

    [EAGLContextsetCurrentContext:self.context];



    PTModelController *mc = PTModelController::shared();

    mc->clean();



    unsigned long size = 0;

    char* pBuffer = (char*)CCFileUtils::sharedFileUtils()->getFileData("data/data.pkg", "rb", &size);

    if (pBuffer != NULL && size > 0){

    mc->setUsingDataEncryption( true );

    }



    mc->loadDataForSplashScreen("data/data.pkg", processor().c_str());



    s_sharedApplication.setDataArchiveProcessor(processor());





    cocos2d::CCApplication::sharedApplication()->run();

    }



    - (void)dealloc{

    if ([EAGLContext currentContext] == self.context) {

    [EAGLContextsetCurrentContext:nil];

    }

    }



    - (void)didReceiveMemoryWarning{

    [superdidReceiveMemoryWarning];

    }



    - (BOOL)prefersStatusBarHidden {

    returnYES;

    }



    - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect{

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);



    cocos2d::CCDirector::sharedDirector()->setViewport();

    cocos2d::CCDirector::sharedDirector()->mainLoop();

    }





    - (void)update{

    if(sheduledForShareWidget == true){

    sheduledForShareWidget = false;



    GLKView *view = (GLKView *)self.view;

    UIImage* screenshot = view.snapshot;



    PTLog("Opens Share Widget: screenshot was taken");



    UIActivityViewController *activityVC = [[UIActivityViewControlleralloc] initWithActivityItems:mad:[shareMessage, screenshot]applicationActivities:nil];



    NSArray *excludeActivities = @[UIActivityTypeSaveToCameraRoll,

    UIActivityTypeAssignToContact];

    activityVC.excludedActivityTypes = excludeActivities;





    float iOSVersion = [[UIDevice currentDevice].systemVersion floatValue];

    if(iOSVersion > 8.0){

    activityVC.popoverPresentationController.sourceView = self.view;

    }



    [selfpresentViewController:activityVC animated:YEScompletion:nil];

    PTLog("opens Share Widget: view controller presented");

    }

    }



    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{

    int ids[IOS_MAX_TOUCHES_COUNT] = {0};

    float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};

    float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};



    int i = 0;

    for (UITouch *touch in touches) {

    ids = (intptr_t)touch;

    xs = [touch locationInView: [touch view]].x * self.view.contentScaleFactor;

    ys = [touch locationInView: [touch view]].y * self.view.contentScaleFactor;

    ++i;

    }

    cocos2d::CCEGLView::sharedOpenGLView()->handleTouchesBegin(i, ids, xs, ys);

    }



    - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{

    int ids[IOS_MAX_TOUCHES_COUNT] = {0};

    float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};

    float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};



    int i = 0;

    for (UITouch *touch in touches) {

    ids = (intptr_t)touch;

    xs = [touch locationInView: [touch view]].x * self.view.contentScaleFactor;;

    ys = [touch locationInView: [touch view]].y * self.view.contentScaleFactor;;

    ++i;

    }

    cocos2d::CCEGLView::sharedOpenGLView()->handleTouchesMove(i, ids, xs, ys);

    }



    - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{

    int ids[IOS_MAX_TOUCHES_COUNT] = {0};

    float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};

    float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};



    int i = 0;

    for (UITouch *touch in touches) {

    ids = (intptr_t)touch;

    xs = [touch locationInView: [touch view]].x * self.view.contentScaleFactor;;

    ys = [touch locationInView: [touch view]].y * self.view.contentScaleFactor;;

    ++i;

    }

    cocos2d::CCEGLView::sharedOpenGLView()->handleTouchesEnd(i, ids, xs, ys);

    }



    - (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{

    int ids[IOS_MAX_TOUCHES_COUNT] = {0};

    float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};

    float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};



    int i = 0;

    for (UITouch *touch in touches) {

    ids = (intptr_t)touch;

    xs = [touch locationInView: [touch view]].x * self.view.contentScaleFactor;;

    ys = [touch locationInView: [touch view]].y * self.view.contentScaleFactor;;

    ++i;

    }

    cocos2d::CCEGLView::sharedOpenGLView()->handleTouchesCancel(i, ids, xs, ys);

    }



    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    PTModelGeneralSettingsPtr generalSettings = PTModelGeneralSettings::shared();

    if(generalSettings->orientation() == PTModelGeneralSettings::LandscapeOrientation){

    return UIInterfaceOrientationIsLandscape( interfaceOrientation );

    }

    else if(generalSettings->orientation() == PTModelGeneralSettings::portraitOrientation){

    return UIInterfaceOrientationIsPortrait( interfaceOrientation );

    }



    returnNO;

    }



    - (NSUInteger) supportedInterfaceOrientations{

    PTModelGeneralSettingsPtr generalSettings = PTModelGeneralSettings::shared();

    if(generalSettings->orientation() == PTModelGeneralSettings::LandscapeOrientation){

    returnUIInterfaceOrientationMaskLandscape;



    }

    else if(generalSettings->orientation() == PTModelGeneralSettings::portraitOrientation){

    returnUIInterfaceOrientationMaskPortrait;

    }



    returnNO;

    }



    - (BOOL) shouldAutorotate {

    returnNO;

    }



    -(void) scheduleOpenShareWidget:(const char*) message{

    shareMessage = [NSStringstringWithUTF8String:message];

    sheduledForShareWidget = true;

    }



    @end
     
  4. bailey tucker

    bailey tucker Boxer

    Joined:
    Aug 4, 2018
    Messages:
    5
    Likes Received:
    0
    the thread 1 sigabrt error is from this line

    cocos2d::CCDirector::sharedDirector()->mainLoop();
     
  5. SpoonCrysis

    SpoonCrysis Avid Boxer

    Joined:
    Aug 10, 2018
    Messages:
    175
    Likes Received:
    26
    Hi I had this issue when using the simulators in Xcode, it has no issues creating an archive file though. so i would suggest using test flight and test on a real device or simply use the preview mode in buildbox.
     
  6. bailey tucker

    bailey tucker Boxer

    Joined:
    Aug 4, 2018
    Messages:
    5
    Likes Received:
    0
    this issue didn't appear until I exported it and put it on the app store
     
  7. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Try making another build. Sometimes strange things happen. I made a build and it had zero MB on export. Did it again and bingo. If it continues, clean your game up like Atlases etc.
     
  8. Praaaytogod

    Praaaytogod Boxer

    Joined:
    Jan 14, 2019
    Messages:
    22
    Likes Received:
    0
    I have the EXACT same problem. I've tried testing on my iPhone X, wife's iPhone 7, our iPad. I've tried cleaning up the atlases, rebuilding, renaming and organizing every object and actions in every one of my scenes. I've hidden every part of each scene to make sure there were no extra useless objects laying around. I've taken my heyzap id out of the game settings and tried putting it back in. I've copied everything to clones. I'm tried following some tutorials on YouTube and I'm just out of ideas here. I sent an email to support, but haven't heard back yet. Hopefully, they can come up with something. If anyone has any advice or ideas on what I should be looking for I'm open to ANY input you have. I haven't noticed any pattern. My app just seems to crash whenever it's most inconvenient. Please help :(
     
  9. Praaaytogod

    Praaaytogod Boxer

    Joined:
    Jan 14, 2019
    Messages:
    22
    Likes Received:
    0
    Did you ever solve this?
     
  10. Jaro

    Jaro Avid Boxer

    Joined:
    Sep 21, 2018
    Messages:
    387
    Likes Received:
    126
    I did play your game on my sons ip6 for almost 3 hours and also tested on my 7+ and X and never seen crashes. All works fine.
     
  11. Praaaytogod

    Praaaytogod Boxer

    Joined:
    Jan 14, 2019
    Messages:
    22
    Likes Received:
    0
    So I rebuilt my game from scratch and the new version of it crashes with the same error. I’m quite confused now. I’ve developed another game that I could test on any device and it works fine. I don’t know why I’m getting this error.
     

Share This Page