Possible Bug. App crashes exported in XCode

Hello!,

I first started using Codea this weekend, got a basic physics scene with floor, 2 walls and a ball jumping inside it.
Exported the thing to XCode using the “Export to Dropbox” option.

When I open the project in XCode and try to launch it in the iPad or iPhone simulator it throws an Error and the app does not start.
It says something about SIGABRT.

Im currently at work so you can ask me for more info about this and will provide it as I get back to my macbook.

Is there any known issue with this feature? Something Im missing?

Thank you for your time :),
Nahuel

I think you are missing the Codea Runtime Libary, do you? What I understand it’s REQUIRED to make your app run on a device outside Codea

@nsxNawe The export routine certainly does work (@akaJag, the runtime isn’t needed for the native export) so it might be an issue with your code. Could you post it for experimenting?

Thank you @Andrew_Stacey, that clears stuff up in my head too.

Thank you guys, @akaJag, I had that doubt too about the Codea Runtime Library, so @Andrew_Stacey you just cleared that up for the two of us :P.

My own lua code is just a single Main class.
I just tried posting the code but the forum formatter did not take line breaks so it was very ugly.
Instead, here is a link to the exported zip project.
https://dl.dropboxusercontent.com/u/9496873/HelloWorldphysics.zip

So that is exactly the same I used to pull up a project on XCode.

Cheers, and thank you for your help!

Code can be displayed between triple tildes: ~~~ see the FAQ for details. Here’s your code:


-- Hello World physics

-- Use this function to perform your initial setup
function setup()
    -- Floor and walls
    w1 = physics.body(EDGE,vec2(0,0),vec2(WIDTH,0))
    w2 = physics.body(EDGE,vec2(0,0),vec2(0,WIDTH))
    w3 = physics.body(EDGE,vec2(WIDTH,0),vec2(WIDTH,HEIGHT))
    -- Ball
    ball_diam = 60
    -- The physics object for the ball
    p_ball = physics.body(CIRCLE,ball_diam/2)
    -- Apply gravity
    p_ball.gravityScale = 1
    -- Bounciness, lower for less
    p_ball.restitution = .8
    -- Now friction, if a table surface we set it from 0 and 1
    p_ball.friction = 0
    -- Velocity in pixels per second
    p_ball.linearVelocity = vec2(math.random(400),math.random(400))
    -- Position randomly on screen
    p_ball.x = math.random(60,250)
    p_ball.y = math.random(400,600)
    
    
end

function draw()
    background(200,200,200,255)
    -- Draw the ball
    -- style
    pushStyle()
    fill(255,0,0,255)
    ellipse(p_ball.x,p_ball.y,ball_diam)
    popStyle()
end

Great!, now I can post code :slight_smile: sorry I didnt look at the FAQS first, usually there’s a [code] tag or something…

Anyway, yes, that is the code!, and the zip I attached is the extraction from Codea, but it throws an error :frowning:

Any idea? Did it work for you?

Thank you!

Sometimes export does not include libraries and libcodea.a and libtools.a are missing in Libs folder. I have exported some other project (CargoBot) and copied both files in my project Libs folder.

@ulbin libcodea and libtools will be downloaded when you build an app exported from Codea. This ensures you have the latest versions at build time.

I get several errors like the following when trying to build an exported Codea app in Xcode.

Undefined symbols for architecture i386:
“_SSLClose”, referenced from:
-[GCDAsyncSocket closeWithError:] in libtools.a(GCDAsyncSocket.o)

@SpellCollapse I’ll be posting a fix shortly.

Here’s the fix:

In Xcode, open your exported project:

  • Go to your project settings (click on the blueprint icon in the Project Navigator)
  • Select the “Build Phases” tab
  • Expand “Link Binary With Libraries”
  • Click the + button at the bottom of the list
  • Choose “Security.framework” and click add

Codea 1.5.4 will fix this bug in the exported project template. But you will have to use this workaround for now.