How to set Authorization to URlRequest in swift 3.0

Hi,

I’m getting strange behaviour when posting to get response from server which requires Basic Authorization.my token gets gets expired after every two hours.Every things works fine but some times i dn’t knw but getting reponse from server “Parameter not null” error.i debuged there is nothing going null.i go through document-https://developer.apple.com/reference/foundation/nsmutableurlrequest

where mentioned some http headers could not be modified using methods

addValue(_:forHTTPHeaderField:) or setValue(_:forHTTPHeaderField:)

i cannot figure where is going wrong and more when i’m setting Content & Accept type for json addValue(_:forHTTPHeaderField:) workds gud to set authorization and for xml  setValue(_:forHTTPHeaderField:) works but still .sometimes  they breaks.Below is my code

//for json rsponse
func callWebserviceForJSON(_ urlStr: String ,callback:@escaping (_ data: Dictionary) -> Void)
    {
          
        let url1 = URL(string: urlStr)
        var request = URLRequest(url: url1!)
      
         let tokenId = fileMgr.getCacheData(constants.defaultsKeys.TOKEN_KEY) as! String
      
        let authorizationKey = "Basic ".appending(tokenId)
        request.httpMethod = "POST"
        request.addValue("application/json", forHTTPHeaderField: "Content-Type")
        request.addValue("application/json", forHTTPHeaderField: "Accept")
        request.addValue(authorizationKey, forHTTPHeaderField: "Authorization")
        request.timeoutInterval = 20000.0
      
        var dict = Dictionary()
        let task = URLSession.shared.dataTask(with: request)
          {
            data, response, error -> Void in
     }
//for xml response

/
    func callPostWebservice(_ urlStr: String, callback:@escaping (_ data: Dictionary) -> Void)
    {
       
         
       
        let url1 = URL(string: urlStr)
        var request = URLRequest(url: url1!)
       
         let tokenId = fileMgr.getCacheData(constants.defaultsKeys.TOKEN_KEY) as! String
       
        print("tokenId >> (tokenId) , urlStr >> (urlStr)")
        request.httpMethod = "POST"
        request.addValue("application/xml", forHTTPHeaderField: "Content-Type")
        request.addValue("application/xml", forHTTPHeaderField: "Accept")
        request.setValue("Basic (tokenId)", forHTTPHeaderField: "Authorization")
        request.timeoutInterval = 20000.0
       
        var dict = Dictionary()
        let task = URLSession.shared.dataTask(with: request)
        {data, response, error  in }

Please advice

Powered by WPeMatico

NEPacketTunnelProvider crash when starting tunnel

Date/Time:           2017-04-24 14:17:17.3296 +0500

Launch Time:         2017-04-24 14:17:17.1436 +0500

OS Version:          iPhone OS 10.3.1 (14E304)

Report Version:      104

 

 

Exception Type:  EXC_CRASH (SIGABRT)

Exception Codes: 0x0000000000000000, 0x0000000000000000

Exception Note:  EXC_CORPSE_NOTIFY

Triggered by Thread:  1

 

 

Application Specific Information:

abort() called

 

 

Filtered syslog:

None found

 

 

Last Exception Backtrace:

0   CoreFoundation                 0x18695efd8 __exceptionPreprocess + 124

1   libobjc.A.dylib               0x1853c0538 objc_exception_throw + 56

2   CoreFoundation                 0x186842518 -[__NSDictionaryM setObject:forKey:] + 920

3   Foundation                     0x1873e5184 -[_NSExtensionContextVendor _setPrincipalObject:forUUID:] + 100

4   Foundation                     0x1873e46f8 __105-[_NSExtensionContextVendor _beginRequestWithExtensionItems:listenerEndpoint:withContextUUID:completion:]_block_invoke + 720

5   libdispatch.dylib             0x1858169e0 _dispatch_call_block_and_release + 24

6   libdispatch.dylib             0x1858169a0 _dispatch_client_callout + 16

7   libdispatch.dylib             0x185824ad4 _dispatch_queue_serial_drain + 928

8   libdispatch.dylib             0x18581a2cc _dispatch_queue_invoke + 884

9   libdispatch.dylib             0x185824fa8 _dispatch_queue_override_invoke + 344

10  libdispatch.dylib             0x185826a50 _dispatch_root_queue_drain + 540

11  libdispatch.dylib             0x1858267d0 _dispatch_worker_thread3 + 124

12  libsystem_pthread.dylib       0x185a1f1d0 _pthread_wqthread + 1096

13  libsystem_pthread.dylib       0x185a1ed7c start_wqthread + 4

 

 

 

 

Thread 0 name:  Dispatch queue: com.apple.main-thread

Thread 0:

0   libsystem_kernel.dylib         0x000000018593b224 mach_msg_trap + 8

1   libsystem_kernel.dylib         0x000000018593b09c mach_msg + 72

2   CoreFoundation                 0x000000018690ce88 __CFRunLoopServiceMachPort + 192

3   CoreFoundation                 0x000000018690aadc __CFRunLoopRun + 1060

4   CoreFoundation                 0x000000018683ad94 CFRunLoopRunSpecific + 424

5   Foundation                     0x0000000187354d64 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304

6   Foundation                     0x00000001873a96b4 -[NSRunLoop(NSRunLoop) run] + 88

7   libxpc.dylib                   0x0000000185a5fc54 _xpc_objc_main + 664

8   libxpc.dylib                   0x0000000185a61984 xpc_main + 200

9   Foundation                     0x0000000187562d90 service_connection_handler + 0

10  PlugInKit                     0x000000018f2d912c -[PKService run] + 752

11  PlugInKit                     0x000000018f2d8cf0 +[PKService main] + 56

12  PlugInKit                     0x000000018f2d9150 +[PKService _defaultRun:arguments:] + 20

13  Foundation                     0x0000000187548ba4 NSExtensionMain + 64

14  libdyld.dylib                 0x000000018584959c start + 4

 

 

Thread 1 name:  Dispatch queue: com.apple.extension.global-state-queue

Thread 1 Crashed:

0   libsystem_kernel.dylib         0x0000000185959014 __pthread_kill + 8

1   libsystem_pthread.dylib       0x0000000185a23334 pthread_kill + 112

2   libsystem_c.dylib             0x00000001858cd9c4 abort + 140

3   libc++abi.dylib               0x00000001853991b0 __cxa_bad_cast + 0

4   libc++abi.dylib               0x00000001853b2c04 default_unexpected_handler() + 0

5   libobjc.A.dylib               0x00000001853c0820 _objc_terminate() + 124

6   libc++abi.dylib               0x00000001853af5d4 std::__terminate(void (*)()) + 16

7   libc++abi.dylib               0x00000001853aeef8 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 0

8   libobjc.A.dylib               0x00000001853c066c _objc_exception_destructor(void*) + 0

9   CoreFoundation                 0x0000000186842518 -[__NSCFNumber hash] + 0

10  Foundation                     0x00000001873e5184 -[_NSExtensionContextVendor _setPrincipalObject:forUUID:] + 100

11  Foundation                     0x00000001873e46f8 __105-[_NSExtensionContextVendor _beginRequestWithExtensionItems:listenerEndpoint:withContextUUID:completion:]_block_invoke + 720

12  libdispatch.dylib             0x00000001858169e0 _dispatch_call_block_and_release + 24

13  libdispatch.dylib             0x00000001858169a0 _dispatch_client_callout + 16

14  libdispatch.dylib             0x0000000185824ad4 _dispatch_queue_serial_drain + 928

15  libdispatch.dylib             0x000000018581a2cc _dispatch_queue_invoke + 884

16  libdispatch.dylib             0x0000000185824fa8 _dispatch_queue_override_invoke + 344

17  libdispatch.dylib             0x0000000185826a50 _dispatch_root_queue_drain + 540

18  libdispatch.dylib             0x00000001858267d0 _dispatch_worker_thread3 + 124

19  libsystem_pthread.dylib       0x0000000185a1f1d0 _pthread_wqthread + 1096

20  libsystem_pthread.dylib       0x0000000185a1ed7c start_wqthread + 4

 

 

Thread 2:

0   libsystem_pthread.dylib       0x0000000185a1ed78 start_wqthread + 0

 

 

Thread 3:

0   libsystem_pthread.dylib       0x0000000185a1ed78 start_wqthread + 0

 

 

Thread 4:

0   libsystem_pthread.dylib       0x0000000185a1ed78 start_wqthread + 0

 

 

Thread 5:

0   libsystem_kernel.dylib         0x0000000185959a88 __workq_kernreturn + 8

1   libsystem_pthread.dylib       0x0000000185a1f274 _pthread_wqthread + 1260

2   libsystem_pthread.dylib       0x0000000185a1ed7c start_wqthread + 4

 

 

Thread 1 crashed with ARM Thread State (64-bit):

    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000100c14af7

    x4: 0x00000001853b3b07   x5: 0x000000016dee9530   x6: 0x000000000000006e   x7: 0xffffffffffffffec

    x8: 0x000000000c000000   x9: 0x0000000004000000  x10: 0x000000000000000b  x11: 0x000000000000000b

   x12: 0x0000000000000010  x13: 0x0000000186ba9c0e  x14: 0x0000030000000300  x15: 0x0000000000000000

   x16: 0x0000000000000148  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000006

   x20: 0x000000016deeb000  x21: 0x000000016dee9530  x22: 0x0000000100c16ea0  x23: 0x00000001acc0e0d8

   x24: 0x000000016deeab60  x25: 0x000000016deeabf0  x26: 0x0000000052000000  x27: 0x00000001873e4814

   x28: 0x00000001873e4824   fp: 0x000000016dee9490   lr: 0x0000000185a23334

    sp: 0x000000016dee9470   pc: 0x0000000185959014 cpsr: 0x00000000

 

 

Binary Images:

0x10009c000 – 0x1000a7fff NEPacketTunnelVPNDemoTunnel arm64  <655716f460573e6a862d05c2d142f11b> /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/PlugIns/NEPacketTunnelVPNDemoTunnel.appex/NEPacketTunnelVPNDemoTunnel

0x1000bc000 – 0x1000c7fff libswiftDarwin.dylib arm64  <7ccfeb28f7b13a2ebf31eac6254e117d> /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftDarwin.dylib

0x1000d8000 – 0x1000dffff libswiftObjectiveC.dylib arm64  /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftObjectiveC.dylib

0x100100000 – 0x100133fff dyld arm64  /usr/lib/dyld

0x100188000 – 0x1003cffff libswiftCore.dylib arm64  /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftCore.dylib

0x10069c000 – 0x1006b7fff libswiftDispatch.dylib arm64  <709af8604d533919b09bcd01b5fc747e> /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftDispatch.dylib

0x1006f8000 – 0x1007cbfff libswiftFoundation.dylib arm64  <1a917afbc881343488bad57cd473e24a> /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftFoundation.dylib

0x1008dc000 – 0x10090bfff libswiftSwiftOnoneSupport.dylib arm64  <55ae80f9bafa3e5796df5996b97af8e1> /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftSwiftOnoneSupport.dylib

0x1009c4000 – 0x1009d3fff libswiftCoreGraphics.dylib arm64  <374181edb84e3e578f256b6ca09879df> /var/containers/Bundle/Application/C90BBCC9-616E-468D-84A7-5653BF387184/NEPacketTunnelVPNDemo.app/Frameworks/libswiftCoreGraphics.dylib

0x100a38000 – 0x100a3ffff sdk.dylib arm64  /System/Library/Caches/com.apple.xpc/sdk.dylib

0x185340000 – 0x185341fff libSystem.B.dylib arm64  <6d9ab1f5df1b36d89fd5675936e3da5e> /usr/lib/libSystem.B.dylib

0x185342000 – 0x185397fff libc++.1.dylib arm64  <4d91c4d8858339c7ae2b3716d1f5e0fc> /usr/lib/libc++.1.dylib

0x185398000 – 0x1853b4fff libc++abi.dylib arm64  <5615fb6378773e82a20d5d0727a6132e> /usr/lib/libc++abi.dylib

0x1853b8000 – 0x185795fff libobjc.A.dylib arm64  <64c3c5a56c7a30c39ff4a3ec74426cf4> /usr/lib/libobjc.A.dylib

0x185796000 – 0x18579afff libcache.dylib arm64  /usr/lib/system/libcache.dylib

0x18579b000 – 0x1857a6fff libcommonCrypto.dylib arm64  <0bd3d4cb2d803c6caf1d09e54e8dc705> /usr/lib/system/libcommonCrypto.dylib

0x1857a7000 – 0x1857aafff libcompiler_rt.dylib arm64  /usr/lib/system/libcompiler_rt.dylib

0x1857ab000 – 0x1857b2fff libcopyfile.dylib arm64  /usr/lib/system/libcopyfile.dylib

0x1857b3000 – 0x185814fff libcorecrypto.dylib arm64  <1662015f100e3fab8573f40889935a98> /usr/lib/system/libcorecrypto.dylib

0x185815000 – 0x185844fff libdispatch.dylib arm64  <46e0cb2039333474ba7b47b131153bd5> /usr/lib/system/libdispatch.dylib

0x185845000 – 0x185849fff libdyld.dylib arm64  <649eb4fd79bf30869584b3ec86b6bcbc> /usr/lib/system/libdyld.dylib

0x18584a000 – 0x18584afff liblaunch.dylib arm64  <985c8570c8603f8886372c8fe4843f08> /usr/lib/system/liblaunch.dylib

0x18584b000 – 0x185850fff libmacho.dylib arm64  <3fdc8b3ebe27315aa71cadf73b0e0642> /usr/lib/system/libmacho.dylib

0x185851000 – 0x185852fff libremovefile.dylib arm64  <7e353a2221703ccd99c8bb04a0bdc3dd> /usr/lib/system/libremovefile.dylib

0x185853000 – 0x18586afff libsystem_asl.dylib arm64  <2f456d47db4937c5aa3dee82ab2550ee> /usr/lib/system/libsystem_asl.dylib

0x18586b000 – 0x18586bfff libsystem_blocks.dylib arm64  <373b4d279e6432d5b718ec5b71aebfc4> /usr/lib/system/libsystem_blocks.dylib

0x18586c000 – 0x1858e8fff libsystem_c.dylib arm64  /usr/lib/system/libsystem_c.dylib

0x1858e9000 – 0x1858edfff libsystem_configuration.dylib arm64  <1db4aaed5fdc3cd592a52f7358d1c666> /usr/lib/system/libsystem_configuration.dylib

0x1858ee000 – 0x1858f3fff libsystem_containermanager.dylib arm64  <15235799c22434b78bfd0f93cdc2c9dc> /usr/lib/system/libsystem_containermanager.dylib

0x1858f4000 – 0x1858f5fff libsystem_coreservices.dylib arm64  <31d817e729333cd6be4695ade5abf990> /usr/lib/system/libsystem_coreservices.dylib

0x1858f6000 – 0x18590efff libsystem_coretls.dylib arm64  <099dd5a82bed308882bc1782787b23cc> /usr/lib/system/libsystem_coretls.dylib

0x18590f000 – 0x185915fff libsystem_dnssd.dylib arm64  <58d80a29aee7360ab16718545b8102a2> /usr/lib/system/libsystem_dnssd.dylib

0x185916000 – 0x185939fff libsystem_info.dylib arm64  /usr/lib/system/libsystem_info.dylib

0x18593a000 – 0x18595efff libsystem_kernel.dylib arm64  <2ccf4db33c323a68b05942b8375b90c2> /usr/lib/system/libsystem_kernel.dylib

0x18595f000 – 0x18598bfff libsystem_m.dylib arm64  /usr/lib/system/libsystem_m.dylib

0x18598c000 – 0x1859a7fff libsystem_malloc.dylib arm64  <44978732283439fc92fff8e3ab817123> /usr/lib/system/libsystem_malloc.dylib

0x1859a8000 – 0x185a01fff libsystem_network.dylib arm64  /usr/lib/system/libsystem_network.dylib

0x185a02000 – 0x185a0bfff libsystem_networkextension.dylib arm64  <4d2d53bd1d0133209b896e201160a682> /usr/lib/system/libsystem_networkextension.dylib

0x185a0c000 – 0x185a16fff libsystem_notify.dylib arm64  /usr/lib/system/libsystem_notify.dylib

0x185a17000 – 0x185a1dfff libsystem_platform.dylib arm64  <021e2b400d1b36f1927cd8b9ef5771ff> /usr/lib/system/libsystem_platform.dylib

0x185a1e000 – 0x185a27fff libsystem_pthread.dylib arm64  /usr/lib/system/libsystem_pthread.dylib

0x185a28000 – 0x185a2bfff libsystem_sandbox.dylib arm64  <1a659aa7dc7f34d988fda8e46bbd67d6> /usr/lib/system/libsystem_sandbox.dylib

0x185a2c000 – 0x185a33fff libsystem_symptoms.dylib arm64  <29eb26c4ca5c3bd0aaf1f8bd8ce2e600> /usr/lib/system/libsystem_symptoms.dylib

0x185a34000 – 0x185a46fff libsystem_trace.dylib arm64  /usr/lib/system/libsystem_trace.dylib

0x185a47000 – 0x185a4cfff libunwind.dylib arm64  <0963fc28375630e68ccd844e4f48d1b2> /usr/lib/system/libunwind.dylib

0x185a4d000 – 0x185a4dfff libvminterpose.dylib arm64  /usr/lib/system/libvminterpose.dylib

0x185a4e000 – 0x185a74fff libxpc.dylib arm64  <9bf3e86d19f1318a9b1906a2681cf234> /usr/lib/system/libxpc.dylib

0x185a75000 – 0x185c8afff libicucore.A.dylib arm64  <8784ed7062a139ad9c768ed801bb5c8f> /usr/lib/libicucore.A.dylib

0x185c8b000 – 0x185c9cfff libz.1.dylib arm64  <76ea48b2d8053291891a800d76088c09> /usr/lib/libz.1.dylib

0x186832000 – 0x186bb3fff CoreFoundation arm64  <106dcfdae2ac31b9af16e54e3fdb49be> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation

0x186bb4000 – 0x186bc4fff libbsm.0.dylib arm64  /usr/lib/libbsm.0.dylib

0x186bc5000 – 0x186bc5fff libenergytrace.dylib arm64  <6ec005a9a0a931da96fff946b027ca37> /usr/lib/libenergytrace.dylib

0x186bc6000 – 0x186c41fff IOKit arm64  <04198d723e7f3834914ae5869c25e65c> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit

0x186c42000 – 0x186c62fff libMobileGestalt.dylib arm64  <648fed3bf8af3ccdbd24e5c65e81ceb5> /usr/lib/libMobileGestalt.dylib

0x186c63000 – 0x186d4cfff libxml2.2.dylib arm64  <29f6e338c1f13348970811ca0f0fe293> /usr/lib/libxml2.2.dylib

0x186d4d000 – 0x186de7fff Security arm64  <2423134e64f939aba8368d62495f8197> /System/Library/Frameworks/Security.framework/Security

0x186de8000 – 0x186e53fff SystemConfiguration arm64  /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration

0x186e54000 – 0x186f64fff libsqlite3.dylib arm64  /usr/lib/libsqlite3.dylib

0x186f65000 – 0x1872d9fff CFNetwork arm64  <7074b3e719d23257b4cd53899121f5c8> /System/Library/Frameworks/CFNetwork.framework/CFNetwork

0x1872da000 – 0x1872e7fff libbz2.1.0.dylib arm64  <64376e53acd732f3b5c85ee50b4f01c1> /usr/lib/libbz2.1.0.dylib

0x1872e8000 – 0x187300fff liblzma.5.dylib arm64  <7b9227fb2acb3feda1bffd6427b92fd5> /usr/lib/liblzma.5.dylib

0x187301000 – 0x18731bfff libCRFSuite.dylib arm64  <7c6afb4c2fb13be9a84cf6d72ce823d8> /usr/lib/libCRFSuite.dylib

0x18731c000 – 0x187345fff libarchive.2.dylib arm64  /usr/lib/libarchive.2.dylib

0x187346000 – 0x187347fff liblangid.dylib arm64  /usr/lib/liblangid.dylib

0x187348000 – 0x187617fff Foundation arm64  <73ff2b76d90f3c90b0108f6e36e3b71f> /System/Library/Frameworks/Foundation.framework/Foundation

0x187618000 – 0x1876c3fff libBLAS.dylib arm64  <8efc2fffcc8d3817a73da84ffd232d46> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBLAS.dylib

0x1876c4000 – 0x1879f2fff libLAPACK.dylib arm64  <13c0d7676f6a381aa399570bf0142738> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLAPACK.dylib

0x1879f3000 – 0x187c8dfff vImage arm64  <8984ca1dbdd4341593c2532a3f112644> /System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage

0x187c8e000 – 0x187cb3fff libvMisc.dylib arm64  <1fc0b5b5a59c3ae78efa0a4124bf69b0> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvMisc.dylib

0x187cb4000 – 0x187cc8fff libLinearAlgebra.dylib arm64  <39992b5d7f8a38e7b46ab952e44aa2f2> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libLinearAlgebra.dylib

0x187cc9000 – 0x187cdafff libSparseBLAS.dylib arm64  /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libSparseBLAS.dylib

0x187cdb000 – 0x187d50fff libvDSP.dylib arm64  /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libvDSP.dylib

0x187d51000 – 0x187d51fff vecLib arm64  <6c742a3f1ad83395a1a5f3fc1abd56f8> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/vecLib

0x187d52000 – 0x187d52fff Accelerate arm64  <166a50b815443ce89269964414cfd7b2> /System/Library/Frameworks/Accelerate.framework/Accelerate

0x187d53000 – 0x188297fff CoreGraphics arm64  /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics

0x188298000 – 0x1882acfff GraphicsServices arm64  <93b597044b5234749061bb64ddf8adae> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices

0x1882ad000 – 0x1882fafff AppSupport arm64  /System/Library/PrivateFrameworks/AppSupport.framework/AppSupport

0x1882fb000 – 0x188428fff MobileCoreServices arm64  /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices

0x188429000 – 0x18848afff BaseBoard arm64  <7aa95ea0660f325db0c7e793a3193cc5> /System/Library/PrivateFrameworks/BaseBoard.framework/BaseBoard

0x18848b000 – 0x18849afff AssertionServices arm64  <4cef0d85a60b329e858109f9638abd7c> /System/Library/PrivateFrameworks/AssertionServices.framework/AssertionServices

0x188555000 – 0x18856ffff MobileKeyBag arm64  /System/Library/PrivateFrameworks/MobileKeyBag.framework/MobileKeyBag

0x188570000 – 0x188578fff IOSurface arm64  <419bcf22d97732bd99f6f7bb6b50e133> /System/Library/PrivateFrameworks/IOSurface.framework/IOSurface

0x188579000 – 0x188584fff liblockdown.dylib arm64  /usr/lib/liblockdown.dylib

0x188585000 – 0x18859bfff CrashReporterSupport arm64  /System/Library/PrivateFrameworks/CrashReporterSupport.framework/CrashReporterSupport

0x18859c000 – 0x18859efff IOSurfaceAccelerator arm64  /System/Library/PrivateFrameworks/IOSurfaceAccelerator.framework/IOSurfaceAccelerator

0x18859f000 – 0x1885dffff AppleJPEG arm64  <557e7ca7706f3ab5883060b4d3b375d6> /System/Library/PrivateFrameworks/AppleJPEG.framework/AppleJPEG

0x1885e0000 – 0x188b6cfff ImageIO arm64  <4732d269b83036408adbb7a9c9d28f55> /System/Library/Frameworks/ImageIO.framework/ImageIO

0x188b86000 – 0x188bf0fff libTelephonyUtilDynamic.dylib arm64  <94a0c079a36e367683f208ce4449a249> /usr/lib/libTelephonyUtilDynamic.dylib

0x188bf1000 – 0x188c03fff CommonUtilities arm64  <0421cb6f6d313979b5d6c27b3e802c27> /System/Library/PrivateFrameworks/CommonUtilities.framework/CommonUtilities

0x188c04000 – 0x188c19fff libcompression.dylib arm64  <347a9d75f3a83aae978b77241b0c469b> /usr/lib/libcompression.dylib

0x188c1a000 – 0x188eb2fff CoreData arm64  <149e3207a34f3db289b3c7f9d5ba7344> /System/Library/Frameworks/CoreData.framework/CoreData

0x188eb9000 – 0x188ebefff IOAccelerator arm64  /System/Library/PrivateFrameworks/IOAccelerator.framework/IOAccelerator

0x188ec1000 – 0x188ec4fff libCoreFSCache.dylib arm64  <549cb68e024a3157baacec610957268d> /System/Library/Frameworks/OpenGLES.framework/libCoreFSCache.dylib

0x188f1b000 – 0x188f1bfff libmetal_timestamp.dylib arm64  <4bbc0aeb18653cbcb4e7205c5b0cc630> /System/Library/PrivateFrameworks/GPUCompiler.framework/libmetal_timestamp.dylib

0x188f1c000 – 0x188f7dfff Metal arm64  <2abe00ac599d3a7d88b2741d577528ab> /System/Library/Frameworks/Metal.framework/Metal

0x188fae000 – 0x188fb0fff OAuth arm64  <329757fc3f9335ffae08668c4993906d> /System/Library/PrivateFrameworks/OAuth.framework/OAuth

0x188fb8000 – 0x188ff4fff Accounts arm64  /System/Library/Frameworks/Accounts.framework/Accounts

0x189348000 – 0x18934efff libcupolicy.dylib arm64  <25272348f11f33faa9eef0607d76fb0e> /usr/lib/libcupolicy.dylib

0x18934f000 – 0x1893d8fff CoreTelephony arm64  <00f7ac27a10e3a60a7ae7a68ba302ac8> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony

0x1896c4000 – 0x1896defff ProtocolBuffer arm64  <437889dcd32d3566a0cc4506ab1abba2> /System/Library/PrivateFrameworks/ProtocolBuffer.framework/ProtocolBuffer

0x1896df000 – 0x189707fff PersistentConnection arm64  /System/Library/PrivateFrameworks/PersistentConnection.framework/PersistentConnection

0x189708000 – 0x18970efff DataMigration arm64  <5d2499594aed3827af3546c23a219c55> /System/Library/PrivateFrameworks/DataMigration.framework/DataMigration

0x189d42000 – 0x189d48fff Netrb arm64  /System/Library/PrivateFrameworks/Netrb.framework/Netrb

0x189d5a000 – 0x189d7afff libmis.dylib arm64  /usr/lib/libmis.dylib

0x189e6d000 – 0x189f63fff ManagedConfiguration arm64  /System/Library/PrivateFrameworks/ManagedConfiguration.framework/ManagedConfiguration

0x18f2c8000 – 0x18f2e7fff PlugInKit arm64  /System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit

0x18f8bc000 – 0x18f8c7fff CaptiveNetwork arm64  <5716000af6923d2bb20c914497ce8e98> /System/Library/PrivateFrameworks/CaptiveNetwork.framework/CaptiveNetwork

0x18f8c8000 – 0x18f8f6fff EAP8021X arm64  <9de80177045d3c7981a35dbb49c40bb7> /System/Library/PrivateFrameworks/EAP8021X.framework/EAP8021X

0x193556000 – 0x1935cffff libnetwork.dylib arm64  <3af8267fe2883a70ac1eb0bb5d860470> /usr/lib/libnetwork.dylib

0x1935e3000 – 0x193663fff Network arm64  /System/Library/PrivateFrameworks/Network.framework/Network

0x195f02000 – 0x19603efff NetworkExtension arm64  <7e96365550db32d991fcad658efe18b4> /System/Library/Frameworks/NetworkExtension.framework/NetworkExtension

0x1a0a93000 – 0x1a0ac5fff libpcap.A.dylib arm64  /usr/lib/libpcap.A.dylib

0x1a2a4c000 – 0x1a2a5efff libBNNS.dylib arm64  <4125a50bb8a432208477e6a131df9291> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libBNNS.dylib

0x1a2a5f000 – 0x1a2a63fff libQuadrature.dylib arm64  <4411b9181c5139ddaa9922189f9c7111> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/libQuadrature.dylib

0x1a4780000 – 0x1a4780fff libcoretls.dylib arm64  /usr/lib/libcoretls.dylib

0x1a4781000 – 0x1a4782fff libcoretls_cfhelpers.dylib arm64  /usr/lib/libcoretls_cfhelpers.dylib

 

 

EOF

Powered by WPeMatico

Swift cause pre main launch slower?

https://developer.apple.com/videos/play/wwdc2016/406/

The WWDC 2016 Session 406 video recommend a way to reduce pre-main launch time is to use more swift. But in pratical, I found that the swift cause pre-main launch time become longer. See this article: http://www.lukeparham.com/thing-i-learned-today/2017/3/22/ios-launch-times

I’m confused, why Apple recommended just to use Swift? And is there any way to reduce this time?

Powered by WPeMatico

SIGABRT after updating to iOS 10.3/Xcode 8.3

After updating Xcode to 8.3 and compiling for iOS 10.3 I now get a SIGABRT on release builds on an area of code that ran fine on the previous SDK.

 

malloc: * error for object 0x17415d0c0: Invalid pointer dequeued from free list * set a breakpoint in malloc_error_break to debug”;

 

fileprivate var cache = [UICollectionViewLayoutAttributes]()


// ...


if cache.isEmpty {
    let columnWidth = contentWidth / CGFloat(numberOfColumns())
    var xOffset = [CGFloat]()
    for column in 0 ..< numberOfColumns() {
        xOffset.append(CGFloat(column) * columnWidth )
    }
    var column = 0
    var yOffset = [CGFloat](repeating: 0, count: numberOfColumns())

    for item in 0 ..< collectionView!.numberOfItems(inSection: 0) {
        let indexPath = IndexPath(item: item, section: 0)

        let width = columnWidth - cellPadding.x * 2
        let cellHeight = delegate.collectionView(collectionView!, heightForCellAtIndexPath: indexPath,
                                                  withWidth:width)

        let height = cellPadding.y +  cellHeight + cellPadding.y
        let frame = CGRect(x: xOffset[column], y: yOffset[column], width: columnWidth, height: height)
        let insetFrame = frame.insetBy(dx: cellPadding.x, dy: cellPadding.y)

        let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)
        attributes.frame = insetFrame
        cache.append(attributes) // <------------ SIGABRT happens here

        contentHeight = max(contentHeight, frame.maxY)
        yOffset[column] = yOffset[column] + height
        column = column >= (numberOfColumns() - 1) ? 0 : column + 1
    }
}

 

I have no idea what is going on. I’ve tried reserving the capicity for the cache array, but the issue persists. It only happens on release builds, with whole module optimization (-Onone does not trigger this issue)

Powered by WPeMatico

swift 3 problem with substring

Hello everyone, I have a problem when doing substring. I need to get a string “0x” and the next two characters. If the string is “SDdfsReY0x33Erdfg” I need to get “0x33”.

 

I guess it’s very simple but I’m new to swift programming and I can not understand how the ranges work. Excuse the syntactic and spelling errors.

Powered by WPeMatico

Passing URL with prepare for segue to WKWebview and setting title

I’m attempting to pass an URL with prepare for segue in this viewController from a button press. Everything I’ve tried and read online has been an old version of swift or not a viable solution for Swift 3.1 I’m having trouble also setting the title of the navigation bar to the WKWebview website title. Both issues I’ve been searching for weeks. Hopefully, I can find some help here. Thanks!

 

 

    @IBAction func easyBtnPressed(_ sender: Any) {

        let randomArticle = articles[Int(arc4random_uniform(UInt32(articles.count)))]

        let easyUrl = URL (string: “https:/

        performSegue(withIdentifier: “toGame”, sender: easyUrl)

     

    }

 

 

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

            if let destination = segue.destination as? Game{

                if let easyURLStart = sender as? URL{

                    destination.startingURL = easyURLStart

                }

            }

        }

 

 

//Second VC named Game

import UIKit

import WebKit

class Game: UIViewController, WKNavigationDelegate{

    @IBOutlet weak var destinationLabel: UILabel!

    @IBOutlet weak var timerLabel: UILabel!

    @IBOutlet weak var webViewContainer: UIView!

    @IBOutlet weak var backgroundImage: UIImageView!

   

  

    var webView: WKWebView!

    var timer = Timer()

    var timerCount: Double = 0.0

    var startTime = Timer()

    var startingURL = URL(string: “”)

    var endingURL = URL(string: “”)

    var clickedLinks = [String]()

    var clickCount = 0

  

    override func viewDidLoad() {

        super.viewDidLoad()

      

        timer = Timer.scheduledTimer(timeInterval: 0.05, target: self, selector: (#selector(Game.countTimerIncrease)), userInfo: nil, repeats: true)

        RunLoop.main.add(timer, forMode: RunLoopMode.commonModes)

    }

  

    override func viewDidAppear(_ animated: Bool) {

        self.navigationController!.navigationBar.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 50.0)

        let webView = WKWebView(frame: .zero)

        webViewContainer.addSubview(webView)

      

        webView.translatesAutoresizingMaskIntoConstraints = false

        let height = NSLayoutConstraint(item: webView, attribute: .height, relatedBy: .equal, toItem: webViewContainer, attribute: .height, multiplier: 1, constant: 0)

        let width = NSLayoutConstraint(item: webView, attribute: .width, relatedBy: .equal, toItem: webViewContainer, attribute: .width, multiplier: 1, constant: 0)

        let leftConstraint = NSLayoutConstraint(item: webView, attribute: .leftMargin, relatedBy: .equal, toItem: webViewContainer, attribute: .leftMargin, multiplier: 1, constant: 0)

        let rightConstraint = NSLayoutConstraint(item: webView, attribute: .rightMargin, relatedBy: .equal, toItem: webViewContainer, attribute: .rightMargin, multiplier: 1, constant: 0)

        let bottomContraint = NSLayoutConstraint(item: webView, attribute: .bottomMargin, relatedBy: .equal, toItem: webViewContainer, attribute: .bottomMargin, multiplier: 1, constant: 0)

        webViewContainer.addConstraints([height, width, leftConstraint, rightConstraint, bottomContraint])

      

      

      

        let myRequest = URLRequest(url: startingURL!)

        webView.load(myRequest as URLRequest)

        webView.scrollView.bounces = false

      

    }

Powered by WPeMatico

Deallocate WindowController + ?

(macOS) In my AppDelegate I have “menu > new window” as an array of WindowControllers (+ ViewController / View with WKWebView), if I close the window and remove the WC from the array I don’t think everything is deallocated from the memory. Not sure what the right practive is to make sure it’s all removed (inc. WKWebView).

 

Any suggestions ?

Powered by WPeMatico

EXC_BAD_INSTRUCTION error with webview

I was just working on a web browser that I decided to makein xcode with swift when I ran into some problems. I don’t have a great understanding for the language, but with what I knew I tried and failed. The main problem is that the program will launch there are some errors in my applicationDidFinishLaunching function that I cant identify. I recieve the error exc_bad_instruction (code=exc_i386_invop subcode=0x0) and cannot solve it so any help is appreciated. Thanks in advance!

 

 

    import Cocoa

    import WebKit

    import Foundation

    @NSApplicationMain

    class AppDelegate: NSObject, NSApplicationDelegate {

 

        @IBOutlet var webViewMain: WebView!

        @IBOutlet weak var window: NSWindow!

 

        func applicationDidFinishLaunching(_ aNotification: Notification) {

 

            webViewMain.shouldCloseWithWindow = true

            webViewMain.drawsBackground = true

 

            let rpStartURL = NSURL(string: “https:/

            let rpRequestURL = NSURLRequest(url: rpStartURL! as URL)

 

            self.webViewMain.mainFrame.load(rpRequestURL as URLRequest!)

        }

 

        func applicationWillTerminate(_ aNotification: Notification) {

        }

 

 

    }

Powered by WPeMatico

How to Show Detail View Controller (Split View)

I have a UITableView that on selection changes the detail view in a split view controller. But when the switch takes place on an iPad, the nav bar gets removed. I do not want to create the navigation bar programmatically, instead I want to reference it from my interface builder storyboard. Any ideas what I’m doing wrong?

 

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 
       let selectedMonster = self.HomeSections[indexPath.row] 
        let myVC = self.storyboard?.instantiateViewController(withIdentifier: selectedMonster) 

        navigationController?.showDetailViewController(myVC!, sender: self) 
    } 

 

Thanks.

Powered by WPeMatico