Here Map iOS Swift Crashed After call NMAApplicationContext.set(appId:.. appCode:...) - ios

I am new on using Here Map's tools (https://developer.here.com). Currently, I am trying to integrate here map tools into my iOS Swift 3 project. However, the first step is to announce my license key and app code that I obtained from here map website by using the following Swift 3 code in the AppDelegate.swift:
NMAApplicationContext.set(appId: kHelloMapAppID, appCode: kHelloMapAppCode)
It crashed my app with the following error messages:
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[__NSCFString appendString:]:
nil argument' First throw call stack: (0x18bed91b8 0x18a91055c
0x18bed9100 0x18be76444 0x10023fad0 0x100260480 0x10025f6a8
0x10025f918 0x1011d9258 0x1011d9218 0x1011e6aec 0x1011dcce0
0x1011e8e2c 0x1011e8b78 0x18af6b2a0 0x18af6ad8c) libc++abi.dylib:
terminating with uncaught exception of type NSException
The sample project that came with the here map SDK has the same problem.
Is there anyone knowing how to use the SDK?

Finally I figured out what's going on. Except adding the NMAKit.framework into the Xcode environment, we also need to add the link of the bundle, NMABundle.bundle into the environment. The file resides at NMAKit.framework/Resources/NMABundle.bundle so the Xcode environment should have the links of two files:
ProjectName
|
ProjectName
| |
| NMABundle.bundle
|
Frameworks
|
NMAKit.framework
....

Related

Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'

My iOS application is working fine in iOS 10 and newer version. But when I was trying to run my app on iPad mini with iOS version 9.3.2 then Application is crashing.
I am trying to push a view controller and I am using storyboard for all view controllers.
This is my code for push view controller:
self.performSegue(withIdentifier: "PaymentViewcontrolller", sender: self)
I am getting this is error in console and application is crashing:
2018-10-26 16:21:17.223 Food[592:68727] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'
*** First throw call stack:
(0x2447391b 0x23c0ee17 0x24473861 0x28fbb15f 0x28fbadf5 0x28ea3477 0x28ea3b01 0x28fbb10f 0x28fbb0a1 0x28fbadf5 0x28ea2a0b 0x28d55aa3 0x28b28ffb 0x289eea1f 0x28a06e71 0x28b9d1e5 0x28aab4a7 0x28aab1b5 0x28aab12b 0x289eaa73 0x26a82bcd 0x26a7e375 0x26a7e209 0x26a7d6d1 0x26a7d3a5 0x26a76b2b 0x244356c9 0x244339cd 0x24433dff 0x24383229 0x24383015 0x25973ac9 0x28a57189 0x3d8008 0x2402b873)
libc++abi.dylib: terminating with uncaught exception of type NSException
My Xcode version is 9.4.1 and deployment target is iOS 9.2.
I am not able to figure out what is the issue. Already spent whole day for this.

Error only on iOS 9 devices

I can't get my app to run now on certain devices.
int retVal = UIApplicationMain(argc, argv, nil, #"AppController"); <---SIGABRT
In the console I get...
-[BAPushCenter (null selector)]: unrecognized selector sent to instance 0x8a22960
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[BAPushCenter (null selector)]: unrecognized selector sent to instance 0x8a22960'
*** First throw call stack:
(0x2502386b 0x369d6dff 0x25029035 0x369f1a4b 0x25028244 0x24f528e5 0x24f56377
0x1cfa1 0x25026b31 0x24f562b8 0x291baa29 0x293cd61d 0x293e0381 0x293ca91f
0x2d18dccd 0x2d18dfb90x24fe6827 0x24fe6417 0x24fe477f 0x24f371e9 0x24f36fdd
0x291a143f 0x2919c18d 0x2a70d3 0x37101873)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have no idea what BAPushCenter is, I did a project search and can't find it anywhere. I used an exception breakpoint but it didn't show me any more information then original error.
Update: After testing more devices the error only seems to occur on iOS 9 devices. But iOS 9 simulator devices and any other device below iOS 9 work fine. Any ideas?
In my case, because of the "Batch Framework" my app crashes
Figured it out. The class was coming from one of my static libs so i wasn't able to search it. When I figured out what lib was causing the issues I completely removed it from my app and it compiled fine. Once I get an updated version of that lib I'll put it back in my app, thanks.

Swift 2.0 NSPlaceholderDictionary attempt to insert nil object from objects[0]

I ran into a problem which I seem to can't fix.
Whenever I try to run my app (XCode 7 BETA 2) on my device (iOS 9 BETA 2) it crashes at AppDelegate with the following error:
2015-06-24 04:12:46.769 eSports Center 2[1472:96321] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x18433738c 0x1989dbf2c 0x184224da8 0x184224c40 0x100204efc 0x10020508c 0x1001fc968 0x1002027c8 0x18422d360 0x18422d1d0 0x100201f74 0x1001fc3f8 0x1898be414 0x1890f23c0 0x1890ed008 0x1898d48c4 0x1002281bc 0x1898be414 0x1890f23c0 0x1890ed008 0x1898d48c4 0x189981188 0x18997ec00 0x189997048 0x189996d58 0x189996a60 0x1898fc19c 0x1898fa518 0x18998a974 0x1899808c0 0x18997fa90 0x18997f6b8 0x18997f620 0x1898be414 0x1890f23c0 0x1890ed008 0x1890ecec8 0x1890ec594 0x1890ec2e8 0x1890e5ab8 0x1842ee39c 0x1842ec114 0x1842190f0 0x18992f838 0x18992a5f0 0x1001192ac 0x19921a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
When I try to run it on the Simulator everything is fine. The App itself is a recode of my current project in Swift 2.0 with some pods (for the first time).
It includes 3 libs and some basic UI stuff, I tried to setup the first TabController tab.
Someone has an idea of how to fix them?
Everything Is working now. One library I'm using, tried to load a Font which wasn't available on my iPhone but on my Simulator (?).
Thanks for all the help, Breakpoint and stepping through the Library code did the trick!

Amazon SNS is crashed with SNSInvalidParameterException in iOS 8?

I have implemented AWS - Simple Notification Service and it was working fine, but after I upgraded my iOS 7 to iOS 8 application is crashed with :
*** Terminating app due to uncaught exception 'AmazonClientException', reason: ''
* First throw call stack:
(0x186f3e084 0x19751c0e4 0x100270224 0x10026f95c 0x1000dd7f0 0x187e0a60c 0x197d3fe80 0x197d3fddc 0x197d3cfb0)
libc++abi.dylib: terminating with uncaught exception of type SNSInvalidParameterException
After execution of below code snippet its crashing,
endPoint.platformApplicationArn = #"arn:aws:sns:eu-west-1:ID:app/APNS_SANDBOX/AppName_Dev";
[amazonClient createPlatformEndpoint:endPoint];
Thank you in advance.
Finally, I've got an solution, this is due to not using same user data for endPoint.customUserData. As Yosuke commented [AmazonLogger verboseLogging]; helped me a lot in tracking the bug.
So try to use same data (as in here #"Test") for one application.
endPoint.customUserData = #"Test";

Integration and Use of W3i iOS Advertiser SDK to advertise our iOS app

I'm integrating W3i Advertiser SDK in iOS app, but app is being crashed at following line.
[[W3iAdvertiserSdk sharedConnector] connectWithAppID:W3I_APP_ID];
and here is exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI W3iPublisherJSONRepresentation]: unrecognized selector sent to instance 0xa1d7520'
*** First throw call stack:
(0x29d3012 0x23fae7e 0x2a5e4bd 0x29c2bbc 0x29c294e 0x16af7a 0x3e25 0xcd57b7 0xcd5da7 0xcd6fab 0xce8315 0xce924b 0xcdacf8 0x2903df9 0x2903ad0 0x2948bf5 0x2948962 0x2979bb6 0x2978f44 0x2978e1b 0xcd67da 0xcd865c 0x2d08d 0x26c5)
libc++abi.dylib: terminate called throwing an exception
I Searched a lot but there is no information on net related to w3i's integration and it's use except w3i's official guideline.
https://associate.w3i.com/integration/W3i_iOS_Advertiser_SDK_Integration_Guide1.htm
https://associate.w3i.com/integration/index.html
Here are steps i'm following:
Step1: Download SDK from W3i
Step2: Drag W3iAdvertiserSdk-3.2.0 folder into project's file folder
Step3 Add a link to the following frameworks if not already present:
AdSupport.framework
UIKit.framework
Foundation.framework
CoreGraphics.framework
Step4: Add to your AppDelegate.m file, #import "W3iAdvertiserSdk.h"
If I run the app after above Integration then app runs fine without any error but when i call the method of W3iAdvertiser to connect with app then it it throws exception which i've already posted above.
// add this line to application's didFinishLaunchingWithOptions method
[[W3iAdvertiserSdk sharedConnector] connectWithAppID:W3I_APP_ID]; //appId created at w3i
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI W3iPublisherJSONRepresentation]: unrecognized selector sent to instance 0xa1d7520'
*** First throw call stack:
(0x29d3012 0x23fae7e 0x2a5e4bd 0x29c2bbc 0x29c294e 0x16af7a 0x3e25 0xcd57b7 0xcd5da7 0xcd6fab 0xce8315 0xce924b 0xcdacf8 0x2903df9 0x2903ad0 0x2948bf5 0x2948962 0x2979bb6 0x2978f44 0x2978e1b 0xcd67da 0xcd865c 0x2d08d 0x26c5)
libc++abi.dylib: terminate called throwing an exception
Can anyone please guide me where i'm going wrong, how to use SDK's functions to connect App with w3i's to advertise our app through w3i ?
You need to follow this step as well:
Add -ObjC to Other Linker Flags in your target's Build Settings. That will allow "Option 1" to not crash.
There are two ways to connect app with w3i:
Option1: Integrate W3i-iOS-SDK, and call it's method "connectWithAppId" at start of application.
Option2: Call W3i "appWasRun" API at start of application
first option didn't work for me, but Option2 is quite easy and working fine.
Here is format of API and it's parameters:
http://api.w3i.com/PublicServices/MobileTrackingApiRestV1.svc/AppWasRun?AppId={APPID}&clientIp={CLIENTIP}&iOSIDFA={advertisingIdentifier}&iOSUDID={IOSUDID}&iOSOpenUDID={IOSOpenUDID}&iOSMD5WLANMAC={iOSMD5WLANMAC}&iOSSha1HashedMac={iOSSha1HashedMac}
Request Type: GET
Required Parameters: APPID (generated by W3I) and at-least one identifier (all parameters are preferred by W3i)
I used only OpenUDID and it worked fine.
http://api.w3i.com/PublicServices/MobileTrackingApiRestV1.svc/AppWasRun?AppId=W3i_APP_ID&iOSOpenUDID=OPEN_UDID
For More Information check the following links.
https://sites.google.com/site/w3ideveloperscom/ios/iOSAFPP/advapi
https://associate.w3i.com/integration/Device_Identifiers.htm
Hope it would help others in future :)

Resources