47niemand / zengl

Automatically exported from code.google.com/p/zengl
0 stars 0 forks source link

"Unrecognized selector" error when using JPEG images on iOS #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a ZenGL application for iOS
2. Add a JPEG file to the project
3. Load a texture using the JPEG file.

When running the application, it will raise an error in jpg_LoadFromMemory 
(unit zgl_textures_jpg) at this line:

  jpg.Color   := CGImageGetColorSpace( jpg.Image.CGImage() );

These are the error details:

[UIImage cGImage]: unrecognized selector sent to instance 0x4c4ecc0
2012-02-02 14:53:41.851 MondoZenGLDemo05[5139:207] *** Terminating app due to 
uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage cGImage]: 
unrecognized selector sent to instance 0x4c4ecc0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00255be9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x013975c2 objc_exception_throw + 47
    2   CoreFoundation                      0x002576fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x001c7366 ___forwarding___ + 966
    4   CoreFoundation                      0x001c6f22 _CF_forwarding_prep_0 + 50
    5   MondoZenGLDemo05                    0x0003b9a8 ZGL_TEXTURES_JPG_JPG_LOADFROMMEMORY$ZGLTMEMORY$POINTER$WORD$WORD$WORD + 296
    6   MondoZenGLDemo05                    0x0003b875 ZGL_TEXTURES_JPG_JPG_LOADFROMFILE$UTF8STRING$POINTER$WORD$WORD$WORD + 53
    7   MondoZenGLDemo05                    0x00039b86 ZGL_TEXTURES_TEX_LOADFROMFILE$UTF8STRING$LONGWORD$LONGWORD$$ZGLPTEXTURE + 534
    8   MondoZenGLDemo05                    0x0002b3de MONDOZENGL_TMZTEXTURE_$__CREATE$crc08140F19 + 206
    9   MondoZenGLDemo05                    0x0002420c DEMO_TDEMOSCENE_$__STARTUP + 140
    10  MondoZenGLDemo05                    0x0002bcea MONDOZENGL_TMZAPPLICATION_$__STARTUP + 74
    11  MondoZenGLDemo05                    0x0002aa61 MONDOZENGL_SYSLOAD + 49
    12  MondoZenGLDemo05                    0x0002d533 ZGL_APPLICATION_APP_INIT + 35
    13  MondoZenGLDemo05                    0x000317da ZGL_MAIN_ZGL_INIT$BYTE$BYTE + 346
    14  MondoZenGLDemo05                    0x0002d744 -[zglCAppDelegate EnterMainLoop] + 36
    15  Foundation                          0x0111c7f6 __NSFireDelayedPerform + 441
    16  CoreFoundation                      0x00236fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    17  CoreFoundation                      0x00238594 __CFRunLoopDoTimer + 1220
    18  CoreFoundation                      0x00194cc9 __CFRunLoopRun + 1817
    19  CoreFoundation                      0x00194240 CFRunLoopRunSpecific + 208
    20  CoreFoundation                      0x00194161 CFRunLoopRunInMode + 97
    21  GraphicsServices                    0x016e9268 GSEventRunModal + 217
    22  GraphicsServices                    0x016e932d GSEventRun + 115
    23  UIKit                               0x0065b42e UIApplicationMain + 1160
    24  MondoZenGLDemo05                    0x00031700 ZGL_MAIN_ZGL_INIT$BYTE$BYTE + 128
    25  MondoZenGLDemo05                    0x0002c5aa MONDOZENGL_TMZAPPLICATION_$__SETSCENE$TMZSCENE + 58
    26  MondoZenGLDemo05                    0x00023e68 DEMO_RUNDEMO + 120
    27  MondoZenGLDemo05                    0x00010e60 PASCALMAIN + 16
    28  MondoZenGLDemo05                    0x00021e26 FPC_SYSTEMMAIN + 70
    29  MondoZenGLDemo05                    0x00010e45 start + 53

What version of the product are you using? On what operating system? With
what compiler - Delphi/FreePascal?
XCode 4.2, iOS SDK 5.0, FPC 2.6.0, iPad 4.2 Simulator

Original issue reported on code.google.com by bil...@planet.nl on 2 Feb 2012 at 10:55

GoogleCodeExporter commented 9 years ago
Read the wiki, especially part about Parsing iOS SDK headers
http://zengl.org/wiki/doku.php?id=compilation:ios

Original comment by dr.andru@gmail.com on 3 Feb 2012 at 6:40

GoogleCodeExporter commented 9 years ago
I did follow the instructions on updating UIImage.inc, but I must have made a 
type-o somewhere. I performed those steps again and now it works.
Sorry to waste your time on this.

Original comment by bil...@planet.nl on 3 Feb 2012 at 3:20