zdavatz / AmiKo-iOS

AmiKo Desitin für iPhone und iPad
https://apps.apple.com/ch/app/amiko-desitin/id687642725
GNU General Public License v3.0
1 stars 2 forks source link

Importing AMK file from AmiKo iOS into Generika App crashes Generika App #44

Closed zdavatz closed 6 years ago

zdavatz commented 6 years ago

The error is the following:

2018-04-05 21:43:24.192642+0200 generika[29669:1525985] -[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb0000000000005a3
2018-04-05 21:43:24.197255+0200 generika[29669:1525985] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xb0000000000005a3'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107b2c1e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x00000001071c1031 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000107bad784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x0000000107aae898 ___forwarding___ + 1432
    4   CoreFoundation                      0x0000000107aae278 _CF_forwarding_prep_0 + 120
    5   generika                            0x0000000103065c83 -[ReceiptViewController entriesCountForViewOfField:] + 1555
    6   generika                            0x000000010306410d -[ReceiptViewController layoutFrames] + 1597
    7   generika                            0x0000000103064e3c -[ReceiptViewController viewWillAppear:] + 140
    8   UIKit                               0x0000000104bafdc0 -[UIViewController _setViewAppearState:isAnimating:] + 442
    9   UIKit                               0x0000000104bb062f -[UIViewController __viewWillAppear:] + 131
    10  UIKit                               0x0000000104bf17f3 -[UINavigationController _startTransition:fromViewController:toViewController:] + 817
    11  UIKit                               0x0000000104bf267e -[UINavigationController _startDeferredTransitionIfNeeded:] + 870
    12  UIKit                               0x0000000104bf38cc -[UINavigationController __viewWillLayoutSubviews] + 150
    13  UIKit                               0x0000000104e4bbd7 -[UILayoutContainerView layoutSubviews] + 231
    14  UIKit                               0x0000000104ad5808 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
    15  QuartzCore                          0x00000001045cc61a -[CALayer layoutSublayers] + 177
    16  QuartzCore                          0x00000001045d082b _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
    17  QuartzCore                          0x000000010455729f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
    18  QuartzCore                          0x0000000104584940 _ZN2CA11Transaction6commitEv + 568
    19  QuartzCore                          0x00000001045856be _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76
    20  CoreFoundation                      0x0000000107ace607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    21  CoreFoundation                      0x0000000107ace55e __CFRunLoopDoObservers + 430
    22  CoreFoundation                      0x0000000107ab2b81 __CFRunLoopRun + 1537
    23  CoreFoundation                      0x0000000107ab230b CFRunLoopRunSpecific + 635
    24  GraphicsServices                    0x000000010aac0a73 GSEventRunModal + 62
    25  UIKit                               0x0000000104a060b7 UIApplicationMain + 159
    26  generika                            0x000000010306a97f main + 111
    27  libdyld.dylib                       0x00000001080e9955 start + 1
    28  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
zdavatz commented 6 years ago

The prescription is actually being imported, it is there after the Crash but it can not be shown.

bettar commented 6 years ago

Just an idea to investigate: AmiKo (both macOS and iOS) use integers for the patient weight and height, whereas Generika uses strings. Of course with a proper specifications document outlining the AMK file format this misunderstanding wouldn't happen.

zdavatz commented 6 years ago

One of them has quotes, the other does not, that is correct. quotes

bettar commented 6 years ago

So it's up to you, the AMK specs creator, to decide which way is the correct way.

bettar commented 6 years ago

Please read a couple of messages above this one

zdavatz commented 6 years ago

The correct way is what the macOS Version uses.

bettar commented 6 years ago

Great. That's settled then :-)

zdavatz commented 6 years ago

Do you think that is the cause for the Crash on Generikacc App?

zdavatz commented 6 years ago

You do not think it is the image?

bettar commented 6 years ago

Just to double check, can Generika import AMK created by AmiKo macOS with integer weight and height ? The problem might be somewhere else still.

zdavatz commented 6 years ago

Yes, of course it can.

bettar commented 6 years ago

The uncaught exception you posted mentioned isEqualToString though...

bettar commented 6 years ago

We have to run Generika with the debugger to gain more insight

zdavatz commented 6 years ago

Follow these steps to set it up:

  1. git clone https://github.com/zdavatz/generikacc
  2. cd generikacc Dir
  3. sudo gem install bundler
  4. bundle install
  5. bundle exec pod setup
  6. bundle exec pod install
  7. Now open the Project via Generika.xcworkspace
  8. Run it in Xcode with "Apple + R".
bettar commented 6 years ago

I commented out the code in Generika that deals with patient weight and height and I could successfully import the AmiKo iOS AMK.

bettar commented 6 years ago

AmiKo macOS generates an AMK with patient weight and height as strings, not integers like I said before. To be more precise, AmiKo macOS deals with patient weight ad height as integers internally, and converts them to strings when saving to AMK file.

zdavatz commented 6 years ago

well the do the same for iOS.

zdavatz commented 6 years ago

AmiKo iOS needs to convert them to strings as well when saving the AMK file.