iOS Question App Crashes only when downloaded from Store

Osp

Member
Licensed User
I have gone through the logs to where the actual problem occurs (with ITools4) ONLY IN THE APP DOWNLOADED FROM THE APPLE STORE (no problems in local dev nor release mode app): the App crashes right after receiving a scan result with iBarcodeScanner, I don't get any problems / debug output when I try to run this either with a non-store cert in release or debug mode, it simply works there.

Here is the part of the logs where it crashes when I use the App downloaded from the store, it is very cryptic and I hope there is an Iphone Expert who can decyhper what is going wrong:
(it actually happens where it says Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1b62d4878') as mentioned this only happens with the App when it is derived from the store, it does not happen when testing in dev or release mode. Only change for Store app... certificates and running it again through the remote builder as a release app with release certs. Everything else work fine with the app. The situation of the crash is the following:
- Scanner stops, Sound plays, scan result is send to webview to process it. First the code of the respective sub in B4i then the logs from the console.... the Beep sub simply plays a previously initialized mediaplayer (ScanNotificator.Initialize(File.DirAssets,"shutter.mp3", "Scanned") as mentioned all works fine except when running the actual store app.


B4X:
Sub Scanner_Detected(Codes As List)
    Scanner.Stop
    Panel2.Visible = False
    Panel1.Visible = True
    Beep("Scan")
    Dim sb As StringBuilder
    sb.Initialize
    For Each code As BarcodeCode In Codes
        sb.Append(code.Value)
    Next
    Private val As String = sb.ToString
    Private s As String = $"Sabatschus.send("${val}")"$
    WKWebView1.EvaluateJavaScript("send", s)
    Wait For WKWebView1_JSComplete(Success As Boolean, Tag As Object, Result As String)
End Sub
B4X:
Jul 11 13:06:48 iPhone-von-Olaf kernel(AppleEmbeddedAudio)[0] <Notice>: Speaker: streaming audio
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Notice>: 935: aqmeio@0x106324430, device 0x88 (AQDefaultDevice), AudioDeviceStart (err 0)
 Jul 11 13:06:49 iPhone-von-Olaf mediaremoted[29] <Notice>: [MediaServerNowPlayingDataSource] Any app is playing did change notification received. SomeClientIsPlaying = YES
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet[294] <Notice>: waves://asdkfjhasdflkahsfdlasfdahs344543
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet[294] <Notice>: Sabatschus.send("waves://asdkfjhasdflkahsfdlasfdahs344543")
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet(WebKit)[294] <Notice>: 0x104258000 - WebProcessProxy::didSetAssertionState(Foreground) taking foreground assertion for network process
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet(WebKit)[294] <Notice>: 0x104258000 - WebProcessProxy::didSetAssertionState(Foreground) taking foreground assertion for network process
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet(WebKit)[294] <Notice>: 0x104258000 - WebProcessProxy::didSetAssertionState(Foreground) taking foreground assertion for network process
 Jul 11 13:06:49 iPhone-von-Olaf mediaremoted(MediaRemote)[29] <Notice>: Posted Active Now Playing Notification kMRMediaRemoteAnyApplicationIsPlayingDidChangeNotification for path origin-iPhone von Olaf-1280262988/client--0/player-(null)
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet[294] <Notice>: true
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet(CoreFoundation)[294] <Notice>: -[NSNull length]: unrecognized selector sent to instance 0x1b62d4878
 Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet(CoreFoundation)[294] <Notice>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1b62d4878'
*** First throw call stack:
(0x183f5ed8c 0x1831185ec 0x183f6c098 0x183f645c8 0x183e4a41c 0x10047f8d0 0x10047f84c 0x1004823a4 0x10047080c 0x10047e128 0x10047ddbc 0x100477684 0x1004cab94 0x193c8141c 0x193b2f160 0x193b2f028 0x193b53ea8 0x193b4b92c 0x193969634 0x193ba86d4 0x19392c618 0x19392f020 0x18b594148 0x18b594408 0x183f07404 0x183f06c2c 0x183f0479c 0x183e24da8 0x185e09020 0x18de41758 0x10046fc44 0x1838b5fc0)
 Jul 11 13:06:49 iPhone-von-Olaf MTLCompilerService(MTLCompiler)[297] <Notice>: Build request: pipeline
 Jul 11 13:06:49 iPhone-von-Olaf MTLCompilerService(MTLCompiler)[297] <Notice>: Compilation (pipeline) time 16.760667 ms
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Notice>: 105: { "action":"client_died", "session":{"ID":"0x1b13e","PID":294,"name":"FuerteCoin Walle"}, "details":null }
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(CoreMedia)[27] <Notice>: -CMSessionMgr- cmsSetIsPlaying: CMSession: 'sid:0x1b13e, FuerteCoin Walle(294), 'prim'' with [SoloAmbientSound/Default] [NonMixable] [System Audio] stopping playing.
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:328:-[CAReportingClient sendMessage:category:type:reporters:]: message {
    Volume = "0.8125";
    VolumeCategory = "Audio/Video";
    VolumeOperationProcess = "com.workandsun.billateria";
    VolumeOperationTime = 1178;
    VolumePlayingState = 0;
}: (
    1769500
)
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(CoreMedia)[27] <Notice>: -CMSessionMgr- cmsSetIsPlaying: CMSession: Starting deactivate timer for client 'sid:0x1b13e, FuerteCoin Walle(294), 'prim''
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:328:-[CAReportingClient sendMessage:category:type:reporters:]: message {
    "active devices" = "[ { vdef, [  ], [ pspk ( 0 ) ] }, { vcal, [ pdln ( 0 ) ], [ puln ( 0 ) ] } ]";
    category = csav;
    "going_active" = 0;
    mode = imdf;
    "staying_active" = 1;
}: (
    1769500
)
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(CoreMedia)[27] <Notice>: -CMSessionMgr- cmsSetIsActive: CMSession: 'sid:0x1b13e, FuerteCoin Walle(294), 'prim'' with category/mode SoloAmbientSound/Default going inactive 0 1
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(VirtualAudio)[27] <Notice>: VirtualAudio_Stream.cpp:241:SetPropertyData: Client request to set virtual format [ 32/44100/1; flags: 0x29; bpp: 4; fpp: 1; Bpf: 4 ] on virtual audio stream 171.
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(CoreMedia)[27] <Notice>: -CMSessionMgr- cmsSetIsActive: CMSession: Stopping deactivate timer for client 'sid:0x1b13e, FuerteCoin Walle(294), 'prim''
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:328:-[CAReportingClient sendMessage:category:type:reporters:]: message {
    Volume = "0.8125";
    VolumeOperationProcess = "com.workandsun.billateria";
    VolumeOperationTime = 1178;
    VolumePlayingState = 0;
}: (
    1769500
)
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(CoreMedia)[27] <Notice>: -CMSUtilities- CMSUtility_SendSessionStateAndVolumeReportToAudioToolBox: Stopping reporter for session : sid:0x1b13e, FuerteCoin Walle(294), 'prim', reporter id = 1769500
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:316:-[CAReportingClient stopReporters:]: stopping (
    1769500
)
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:328:-[CAReportingClient sendMessage:category:type:reporters:]: message {
    "session_duration" = "11.65443801879883";
}: (
    1769500
)
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:273:-[CAReportingClient destroyReporterWithID:]: removing 1769500 from client and server
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Notice>: 192: stopping 1769500
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Notice>: 210: destroying 1769500
 Jul 11 13:06:49 iPhone-von-Olaf com.apple.WebKit.WebContent(WebKit)[295] <Error>: WebLoaderStrategy::networkProcessCrashed: failing all pending resource loaders
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Client relinquished <BKProcessAssertion: 0x103127f20; "CMSession.294."com.workandsun.billateria"."SoloAmbientSound".isPlayingProcessAssertion" (audio:inf); id:\M-b\M^@\M-&711BE47E67DC>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] Deactivate assertion: <BKProcessAssertion: 0x103127f20; "CMSession.294."com.workandsun.billateria"."SoloAmbientSound".isPlayingProcessAssertion" (audio:inf); id:\M-b\M^@\M-&711BE47E67DC>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] dump all assertions HWM:4 (deactivateAssertion): {
    <BKProcessAssertion: 0x103119840; "Resume" (activation:inf); id:\M-b\M^@\M-&052D399E08EA> [active]
    <BKProcessAssertion: 0x10313c580; "com.apple.WebKit.ProcessAssertion" (finishTask:180s); id:\M-b\M^@\M-&343C90836188> [active]
}
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] Scheduling allow-idle-sleep timer with interval: 180.0
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] Setting jetsam priority to 10 [0x10108]
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] dump all assertions HWM:4 (CPUMON check): {
    <BKProcessAssertion: 0x103119840; "Resume" (activation:inf); id:\M-b\M^@\M-&052D399E08EA> [active]
    <BKProcessAssertion: 0x10313c580; "com.apple.WebKit.ProcessAssertion" (finishTask:180s); id:\M-b\M^@\M-&343C90836188> [active]
}
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Updating PowerAssertion on FuerteCoin Wall:294
 Jul 11 13:06:49 iPhone-von-Olaf SpringBoard(KeyboardArbiter)[55] <Error>: HW kbd: Failed to set (null) as keyboard focus
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(libAudioStatistics.dylib)[27] <Notice>: CAReportingClient.mm:273:-[CAReportingClient destroyReporterWithID:]: removing 1769503 from client and server
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Notice>: 210: destroying 1769503
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] Remove assertion: <BKProcessAssertion: 0x103127f20; "CMSession.294."com.workandsun.billateria"."SoloAmbientSound".isPlayingProcessAssertion" (audio:inf); id:\M-b\M^@\M-&711BE47E67DC>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] dump all assertions HWM:4 (CPUMON check): {
    <BKProcessAssertion: 0x103119840; "Resume" (activation:inf); id:\M-b\M^@\M-&052D399E08EA> [active]
    <BKProcessAssertion: 0x10313c580; "com.apple.WebKit.ProcessAssertion" (finishTask:180s); id:\M-b\M^@\M-&343C90836188> [active]
}
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Updating PowerAssertion on FuerteCoin Wall:294
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: -[BKAssertion dealloc] - <0x103127f20>
 Jul 11 13:06:49 iPhone-von-Olaf mediaremoted[29] <Notice>: [MediaServerNowPlayingDataSource] Any app is playing did change notification received. SomeClientIsPlaying = NO
 Jul 11 13:06:49 iPhone-von-Olaf mediaremoted(MediaRemote)[29] <Notice>: Posted Active Now Playing Notification kMRMediaRemoteAnyApplicationIsPlayingDidChangeNotification for path origin-iPhone von Olaf-1280262988/client--0/player-(null)
 Jul 11 13:06:49 iPhone-von-Olaf backboardd(BaseBoard)[60] <Error>: Unable to get short BSD proc info for 294: No such process
 Jul 11 13:06:49 iPhone-von-Olaf backboardd(BaseBoard)[60] <Error>: Unable to get proc info for 294: Undefined error: 0
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Notice>: 390: AQME device AQDefaultDevice: client stopping: <AudioQueueObject@0x10396ee00; sid:0x1b13e, FuerteCoin Walle(294), 'prim'; play>; running count now 0
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(RTCReporting)[27] <Notice>: startLogging: Client starts logging...
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(AudioToolbox)[27] <Error>: 294: flush error Nothing to flush
 Jul 11 13:06:49 iPhone-von-Olaf mediaserverd(RTCReporting)[27] <Notice>: aboutToDealloc: RTCReporting client session 0x106c2b870 is about to dealloc
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd[247] <Notice>: createReportingSessionWithDelegate: retained XPC Transaction. Ref count is 2
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd[247] <Notice>: updateCorrelatedSessions: Session 4294967295 has no correlated sessions as it is a standalone session
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd(RTCReporting)[247] <Notice>: getPersistentIdentifierForDNU: The value for uuidRespectDNU: <private>
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd(RTCReporting)[247] <Notice>: getPersistentIdentifierForDNU: The value for uuidOverrideDNU: <private>
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd[247] <Error>: RTCReportingBackend(newBackendWithName): release_timeout
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd(RTCReporting)[247] <Notice>: getPersistentIdentifierForDNU: The value for uuidRespectDNU: <private>
 Jul 11 13:06:49 iPhone-von-Olaf rtcreportingd(RTCReporting)[247] <Notice>: getPersistentIdentifierForDNU: The value for uuidOverrideDNU: <private>
 Jul 11 13:06:49 iPhone-von-Olaf ReportCrash(CrashReporterSupport)[300] <Notice>: Trying to create CR directory structure as root
 Jul 11 13:06:49 iPhone-von-Olaf callservicesd(CallKit)[129] <Notice>: Connection invalidated for call controller host connection: <private>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [com.apple.WebKi:295] Port death watcher fired.
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Server invalidated <BKProcessAssertion: 0x103033750; "Web content visible" (extension:inf); id:\M-b\M^@\M-&4A569E74F54A>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Client relinquished <BKProcessAssertion: 0x103034780; "Web content visible" (extension:inf); id:\M-b\M^@\M-&869A468CB066>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Client relinquished <BKProcessAssertion: 0x103033750; "Web content visible" (extension:inf); id:\M-b\M^@\M-&4A569E74F54A>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Client relinquished <BKProcessAssertion: 0x10313c580; "com.apple.WebKit.ProcessAssertion" (finishTask:180s); id:\M-b\M^@\M-&343C90836188>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] Deactivate assertion: <BKProcessAssertion: 0x10313c580; "com.apple.WebKit.ProcessAssertion" (finishTask:180s); id:\M-b\M^@\M-&343C90836188>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] dump all assertions HWM:4 (deactivateAssertion): {
    <BKProcessAssertion: 0x103119840; "Resume" (activation:inf); id:\M-b\M^@\M-&052D399E08EA> [active]
}
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [com.apple.WebKi:296] Port death watcher fired.
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [com.apple.WebKi:296] Ignoring assertion remove, because we are terminated or pending termination
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [com.apple.WebKi:295] Ignoring assertion remove, because we are terminated or pending termination
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Server invalidated <BKProcessAssertion: 0x103034780; "Web content visible" (extension:inf); id:\M-b\M^@\M-&869A468CB066>
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] New process assertion state; preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep (assertion 0x10313c580 added: (none); removed: preventIdleSleep)
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] Setting jetsam priority to 10 [0x10100]
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: [FuerteCoin Wall:294] dump all assertions HWM:4 (CPUMON check): {
    <BKProcessAssertion: 0x103119840; "Resume" (activation:inf); id:\M-b\M^@\M-&052D399E08EA> [active]
}
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Releasing PowerAssertion on FuerteCoin Wall:294 from update
 Jul 11 13:06:49 iPhone-von-Olaf assertiond[66] <Notice>: Process exited: <BKProcess: 0x10303f8b0; com.apple.WebKi; com.apple.WebKit.WebContent; pid: 295; agency: Extension; visibility: foreground; task: none; hostpid: 294>
 Jul 11 13:06:49 iPhone
 

Osp

Member
Licensed User
Not sure if this could be ideas I guess Erel would know this best: Is it OK to have an If ...then else if then.. Else ...End If with the last stub of it between Else and End If completely empty? It does not provoke problems when running in release or dev mode for local testing though. Just an idea because the Beep Sub has this empty finale when checking which sound to play. Also would removing the Wait For statement make any difference? It is not needed and I not returning anything from the Javascript function anyway it is still there from some former "testing" times.
 

Erel

Administrator
Staff member
Licensed User
Not sure if this could be ideas I guess Erel would know this best: Is it OK to have an If ...then else if then.. Else ...End If with the last stub of it between Else and End If completely empty?
It is fine.

I don't think that the crash happens in the sub you posted.

Where is the log commands that prints this line:
Jul 11 13:06:49 iPhone-von-Olaf FuerteCoin Wallet[294] <Notice>: true
?

The error is probably related to a null array that your program tries to access.
 

Osp

Member
Licensed User
Hi, thanks for your suggestions! As I said there is nothing printing those line - it is the log from a program called ITools4 which you can connect with your Iphones even from Windows. It is the only way I can log anything from a store app.
If you mean though it must be a log command from B4i - the only one that I have in the whole program is a line in override_url which logs the URL like Log(URL) before deciding what to do depending on the received parameter. Then in each IF... Then it returns true if there's a match and after all if ..thens it returns false to allow for local loading of files in the web view. Hm- does that enlighten anything here?

B4X:
Sub WKWebView1_OverrideUrl (Url As String) As Boolean
    Log(Url)
    If Url.EndsWith("fuertecoin.com/scanner") Then
        Scan
        Return True
    End If
    If Url.EndsWith("/shareit") Then
        Share(Url)
        Return True
    End If
    If Url.EndsWith("/openurl") Then
        OpenUrl(Url)
        Return True
    End If
    If Url.EndsWith("/playscan") Then
        Beep("Scan")
        Return True
    End If
    If Url.EndsWith("/playreceive") Then
        Beep("Receive")
        Return True
    End If
    If Url.EndsWith("/playtransaction") Then
        Beep("Transaction")
        Return True
    End If
    Return False
End Sub
 

Osp

Member
Licensed User
hmmmm a null array. The only place where actually an array or array-like structure would be used is the mentioned Scanner_Detected Sub. But that literally can't be getting a null value because it is only called when the scanner detects something? Would the StringBuilder complaint for example in the ToString method if it is null?
The whole thing comes down to: It works in debug and release mode, with the very same barcode to be scanned, but only as long as the app is not from the store. Same app from store... crashes.
Ah - I have one more place where arrays are in use, in the Share Sub, but that one works as expected.
 

Erel

Administrator
Staff member
Licensed User
As I said there is nothing printing those line - it is the log from a program called ITools4 which you can connect with your Iphones even from Windows. It is the only way I can log anything from a store app.
This is very interesting. I wasn't familiar with this tool. Can you provide more information about it?

If you like you can send me the complete project. Maybe I will be able to find it.
 

Osp

Member
Licensed User
Hm - I was just looking around the web for a windows compatible tool to connect with Iphones with logging capacities and stumbled over it just yesterday:
https://www.itools4.com/ it is pretty cool because you really get every single little thingy that is going on in the phone when you connect it, makes you look for the interesting lines for a while but you really get a lot of stuff printed and if you know coding in Apple probably it provides you with what you need but I never looked into native Apple coding so far so I am a bit clueless especially because the error doesn't really tell much more than just saying hey, just received null where I expected "something".
How would you need the app? I can send you the complete folder if you like - thanks a lot for trying to help - as I said weirdly enough it only affects store app not apps that I can debug / open in release mode locally.
 

Osp

Member
Licensed User
Actually looking at their website it doesn't look as if it would have that logging feature but it has

One problem - the forum doesn't allow for the whole folder to be send, it's too big - can I email it to you or send a download link via sendspace or so?
 

Osp

Member
Licensed User
Great : ) I have send you a download link on that email address :) via sendspace.com
 

Erel

Administrator
Staff member
Licensed User
Try it with this code:
B4X:
Sub Scanner_Detected(Codes As List)
   Log("Scanner_Detected 1")
   Panel2.Visible = False
   Panel1.Visible = True
   Log("Scanner_Detected 2")
   Beep("Scan")
   Log("Scanner_Detected 3")
   Dim sb As StringBuilder
   sb.Initialize
   For Each code As BarcodeCode In Codes
       sb.Append(code.Value)
   Next
   Log("Scanner_Detected 4")
   Private val As String = sb.ToString
   Private s As String = $"Sabatschus.send("${val}")"$
   Log("Scanner_Detected 5")
   WKWebView1.EvaluateJavaScript("send", s)
   Sleep(50)
   Scanner.Stop
   Log("Scanner_Detected 6")
End Sub
 

Osp

Member
Licensed User
Ok - great suggestion to give it some time and reverse things to some extend in that sub - will try that, thanks Erel!
 

Osp

Member
Licensed User
...I hope though the scanner doesn't scan another result while in the stub - the sleep is not giving back control to anything it just sits where it is, right?
 

Osp

Member
Licensed User
..thought about the variable too but it doesn't seem necessary, even. Once it's through Apple's a bit lengthy publishing process (although this time it should be much quicker than the first version - because of the "topic" cryptocurrency it took about 3months to get it into the store and loads of communications) we can tell if that works - in local testing as before it works well so I think it should be fine without preventing the reentering. Thanks for your great support!
 

Osp

Member
Licensed User
Hey, Erel - perfect solution, it works :) no scanner crashes from store app anymore!
Seems like sometimes we need to experiment with order and timing of things when communications are going on between parts or processes :)
 
Top