How to solve my unrecognised iOS device behaviour?

0

I have a running application on the iPhone 4s device. I receive data from BLE device on FG and BG modes, and write the received data to DB and a BLE mac to text file on iOS.

Sometimes the file is deleted when i lunch the application.

My code of writing to text file

+(void) UpdateTextFile{

    //get the documents directory:
    NSArray *paths = NSSearchPathForDirectoriesInDomains
    (NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *documentsDirectory = [paths objectAtIndex:0];

    //make a file name to write the data to using the documents directory:
    NSString *fileName = [NSString stringWithFormat:@"%@/MID.txt",
                          documentsDirectory];
    NSFileManager *filemgr = [NSFileManager defaultManager];



    BOOL success = [filemgr fileExistsAtPath:fileName];

    if (success == YES) {
        NSFileHandle *myHandle = [NSFileHandle fileHandleForWritingAtPath:fileName];


        LogDebug("Update File Content");

        [myHandle truncateFileAtOffset: 0];

        stringWithFormat:@"%llu\n",braceletID] dataUsingEncoding:NSUTF8StringEncoding]];
        [myHandle closeFile];


        [Defs ErrorLogging:[NSString stringWithFormat:@"Update file"]];
    }else
    {
        LogError(@"No file");
        [Defs ErrorLogging:[NSString stringWithFormat:@"No MID file"]];
    }

}

also i have get a crash report that i don't know if it is relevance to this:

Incident Identifier: D763D4E0-19F1-4CA4-B45F-CB8545287F03
CrashReporter Key:   7bdf0f8901538029d4ad24b28464939238c4b283
Hardware Model:      iPhone4,1
Process:             LEAF_v2 [263]
Path:                /private/var/mobile/Containers/Bundle/Application/B66DF308-C068-44D0-8CAF-A980989B4E84/LEAF_v2.app/LEAF_v2
Identifier:          com.SDS.LEAF-v2
Version:             1.0.150325 (1.0)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2015-03-25 15:20:22.052 +0200
Launch Time:         2015-03-25 15:18:03.973 +0200
OS Version:          iOS 8.2 (12D508)
Report Version:      105

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Last Exception Backtrace:
(0x2b7235a2 0x39441c72 0x2b637172 0x14b910 0x2ab05218 0x2ab9d3fa 0x2ab9d7f0 0x399acc7e 0x399acc6a 0x399b854e 0x2b6e988c 0x2b6e7fac 0x2b634b4c 0x2b63495e 0x32b9a1a4 0x2ec86c8c 0xd4714 0x399eaaaa)

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x39ab0df0 0x39a9c000 + 85488
1   libsystem_pthread.dylib         0x39b30c92 0x39b2d000 + 15506
2   libsystem_c.dylib               0x39a4f934 0x39a06000 + 301364
3   libc++abi.dylib                 0x38c4ebb8 0x38c4e000 + 3000
4   libc++abi.dylib                 0x38c6866a 0x38c4e000 + 108138
5   libobjc.A.dylib                 0x39441f0e 0x3943b000 + 28430
6   libc++abi.dylib                 0x38c65dec 0x38c4e000 + 97772
7   libc++abi.dylib                 0x38c655ac 0x38c4e000 + 95660
8   libobjc.A.dylib                 0x39441d46 0x3943b000 + 27974
9   CoreFoundation                  0x2b637172 0x2b61b000 + 115058
10  LEAF_v2                         0x0014b912 0xcd000 + 518418
11  AddressBookUI                   0x2ab05218 0x2aad6000 + 193048
12  AddressBookUI                   0x2ab9d3fa 0x2aad6000 + 816122
13  AddressBookUI                   0x2ab9d7f0 0x2aad6000 + 817136
14  libdispatch.dylib               0x399acc80 0x399ab000 + 7296
15  libdispatch.dylib               0x399acc6c 0x399ab000 + 7276
16  libdispatch.dylib               0x399b854e 0x399ab000 + 54606
17  CoreFoundation                  0x2b6e988c 0x2b61b000 + 845964
18  CoreFoundation                  0x2b6e7fac 0x2b61b000 + 839596
19  CoreFoundation                  0x2b634b4c 0x2b61b000 + 105292
20  CoreFoundation                  0x2b63495e 0x2b61b000 + 104798
21  GraphicsServices                0x32b9a1a4 0x32b91000 + 37284
22  UIKit                           0x2ec86c8c 0x2ec18000 + 453772
23  LEAF_v2                         0x000d4714 0xcd000 + 30484
24  libdyld.dylib                   0x399eaaac 0x399e9000 + 6828

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x39a9d24c 0x39a9c000 + 4684
1   libdispatch.dylib               0x399bd4ec 0x399ab000 + 74988
2   libdispatch.dylib               0x399bd21e 0x399ab000 + 74270

Thread 2 name:  com.apple.coremedia.player.async
Thread 2:
0   libsystem_kernel.dylib          0x39a9d4ec 0x39a9c000 + 5356
1   libdispatch.dylib               0x399bab8e 0x399ab000 + 64398
2   MediaToolbox                    0x2d13ab56 0x2d136000 + 19286
3   CoreMedia                       0x2be90bb4 0x2be62000 + 191412
4   libsystem_pthread.dylib         0x39b2fde8 0x39b2d000 + 11752
5   libsystem_pthread.dylib         0x39b2fd5a 0x39b2d000 + 11610
6   libsystem_pthread.dylib         0x39b2db04 0x39b2d000 + 2820

Thread 3:
0   libsystem_kernel.dylib          0x39ab19c0 0x39a9c000 + 88512
1   libsystem_pthread.dylib         0x39b2de20 0x39b2d000 + 3616
2   libsystem_pthread.dylib         0x39b2daf8 0x39b2d000 + 2808

Thread 4:
0   libsystem_kernel.dylib          0x39ab19c0 0x39a9c000 + 88512
1   libsystem_pthread.dylib         0x39b2de20 0x39b2d000 + 3616
2   libsystem_pthread.dylib         0x39b2daf8 0x39b2d000 + 2808

Thread 5:
0   libsystem_kernel.dylib          0x39ab19c0 0x39a9c000 + 88512
1   libsystem_pthread.dylib         0x39b2de20 0x39b2d000 + 3616
2   libsystem_pthread.dylib         0x39b2daf8 0x39b2d000 + 2808

Thread 6:
0   libsystem_kernel.dylib          0x39ab19c0 0x39a9c000 + 88512
1   libsystem_pthread.dylib         0x39b2de20 0x39b2d000 + 3616
2   libsystem_pthread.dylib         0x39b2daf8 0x39b2d000 + 2808

Thread 7 name:  com.apple.NSURLConnectionLoader
Thread 7:
0   libicucore.A.dylib              0x3900b130 0x38ee4000 + 1208624
1   libicucore.A.dylib              0x38f5cc60 0x38ee4000 + 494688
2   libicucore.A.dylib              0x38f5cb94 0x38ee4000 + 494484
3   libicucore.A.dylib              0x38f9c53c 0x38ee4000 + 755004
4   libicucore.A.dylib              0x38f7b1bc 0x38ee4000 + 618940
5   CoreFoundation                  0x2b7122a0 0x2b61b000 + 1012384
6   CoreFoundation                  0x2b6d2136 0x2b61b000 + 749878
7   CoreFoundation                  0x2b6d3688 0x2b61b000 + 755336
8   Foundation                      0x2c3cd510 0x2c38c000 + 267536
9   Foundation                      0x2c394488 0x2c38c000 + 33928
10  LEAF_v2                         0x0028399a 0xcd000 + 1796506
11  LEAF_v2                         0x00289514 0xcd000 + 1819924
12  LEAF_v2                         0x0028934a 0xcd000 + 1819466
13  LEAF_v2                         0x00289a1a 0xcd000 + 1821210
14  CoreFoundation                  0x2b65ae24 0x2b61b000 + 261668
15  CFNetwork                       0x2b189412 0x2b16c000 + 119826
16  CFNetwork                       0x2b187f16 0x2b16c000 + 114454
17  CFNetwork                       0x2b187e7c 0x2b16c000 + 114300
18  CFNetwork                       0x2b187e16 0x2b16c000 + 114198
19  CFNetwork                       0x2b1e6d80 0x2b16c000 + 503168
20  CFNetwork                       0x2b173e5e 0x2b16c000 + 32350
21  CFNetwork                       0x2b173d08 0x2b16c000 + 32008
22  CFNetwork                       0x2b1fcdd8 0x2b16c000 + 593368
23  CFNetwork                       0x2b1fcc82 0x2b16c000 + 593026
24  CoreFoundation                  0x2b69aa14 0x2b61b000 + 522772
25  CoreFoundation                  0x2b69a96c 0x2b61b000 + 522604
26  CoreFoundation                  0x2b6ea234 0x2b61b000 + 848436
27  CoreFoundation                  0x2b6e9646 0x2b61b000 + 845382
28  CoreFoundation                  0x2b6e7cc4 0x2b61b000 + 838852
29  CoreFoundation                  0x2b634b4c 0x2b61b000 + 105292
30  CoreFoundation                  0x2b63495e 0x2b61b000 + 104798
31  CFNetwork                       0x2b1e8722 0x2b16c000 + 509730
32  Foundation                      0x2c45d4b6 0x2c38c000 + 857270
33  libsystem_pthread.dylib         0x39b2fde8 0x39b2d000 + 11752
34  libsystem_pthread.dylib         0x39b2fd5a 0x39b2d000 + 11610
35  libsystem_pthread.dylib         0x39b2db04 0x39b2d000 + 2820

Thread 8 name:  com.apple.CFSocket.private
Thread 8:
0   libsystem_kernel.dylib          0x39ab1080 0x39a9c000 + 86144
1   CoreFoundation                  0x2b6edf7e 0x2b61b000 + 864126
2   libsystem_pthread.dylib         0x39b2fde8 0x39b2d000 + 11752
3   libsystem_pthread.dylib         0x39b2fd5a 0x39b2d000 + 11610
4   libsystem_pthread.dylib         0x39b2db04 0x39b2d000 + 2820

Thread 9:
0   libsystem_kernel.dylib          0x39ab19c0 0x39a9c000 + 88512
1   libsystem_pthread.dylib         0x39b2de20 0x39b2d000 + 3616
2   libsystem_pthread.dylib         0x39b2daf8 0x39b2d000 + 2808

Thread 0 crashed with ARM Thread State (32-bit):
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000000      r3: 0x00000003
    r4: 0x00000006    r5: 0x3c4a29dc      r6: 0x3c48e840      r7: 0x00974dc8
    r8: 0x17f1d460    r9: 0x7420666f     r10: 0x17dd1d90     r11: 0x17f1d484
    ip: 0x00000148    sp: 0x00974dbc      lr: 0x39b30c97      pc: 0x39ab0df0
  cpsr: 0x00000010
ios
objective-c
crash-reports
asked on Stack Overflow Mar 25, 2015 by user3428151

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0