onryldz / x-superobject

Delphi Cross Platform Rapid JSON
316 stars 118 forks source link

Projects fail in iOS when adding XSuperObject #70

Closed djjd47130 closed 9 years ago

djjd47130 commented 9 years ago

Using Delphi XE8, I have issues using XSuperObject on iOS (iPad Air Simulator) 8.2 and 8.3. So I started an empty Firemonkey app, started adding some things which were in my prior project (at this point I didn't know what the issue was). All worked fine up until I added the latest XSuperObject and XSuperJSON units to my app. Upon running in the iOS simulator, I get an exception:

Project dyld_sim raised exception class EOSError with message 'System Error. Code: 2. No such file or directory.

When I break, it takes me to:

System.SysUtils.RaiseLastOSError - last line raise Error;

...which is just the spot where the actual exception itself was raised, nothing of relevance.

So I opened the main project file and put a break point right on the first line "Application.Initialize;" but that break point is never reached. I also put breakpoints in the "initialization" of both XSuperObject and XSuperJSON and neither of them stop either.

Once I removed both units, everything worked again.

X-SuperObject Version: Pulled update from here just prior to reporting Delphi XE8 Version 22.0.19027.8951 (No Updates) IDE OS: Windows 7 SP1 (Version 6.1, Build 7601, 64bit) Mac OS: OS-X 10.10.3 Target OS: iOS Simulator - iPad Air / iOS 8.2 (12D508)

djjd47130 commented 9 years ago

NOTE: Above version details are just one specific example, but I cannot get it to work on any iOS device/version.

djjd47130 commented 9 years ago

Discussion on Stack Overflow:

http://stackoverflow.com/questions/30547414/projects-fail-to-start-in-ios-when-adding-xsuperobject

djjd47130 commented 9 years ago

I found exactly where the exception happens...

In System.RegularExpressionsCore:

{$IFDEF DYNAMIC_LIB} class constructor TPerlRegEx.Create; begin if not LoadPCRELib then RaiseLastOSError; //<-- Exception raised here end;

class destructor TPerlRegEx.Destroy; begin UnloadPCRELib; end; {$ENDIF DYNAMIC_LIB}

So it seems to be unable to find /usr/lib/libpcre.dylib, but only if I'm using X-SuperObject. If I use System.RegularExpressionsCore by itself without XSuperJSON, it works just fine.

djjd47130 commented 9 years ago

I've updated XCode and all SDK references, and verified all matches, but still this issue persists.

djjd47130 commented 9 years ago

The problem was solved by installing an iOS 8 Hotfix for Delphi XE8, specifically fixing the way in which the PCRELib is loaded.