Gimbal Geofence monitoring crashing NSInvalidArgumentException -[NSURL initFileURLWithPath:] - ios7

After integrating Gimbal FYX beacon discovery I tried to add Geofence monitoring as well. I've follow the guides closely and re-written the code several times, ending up with the same crash and error message:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSURL initFileURLWithPath:]: nil string parameter'
Nowhere in my code am I accessing any files or creating any NSObjects from initWithContentsOfFile: methods!
My Code:
[connector enableFromViewController:viewController success:^{
NSLog(#"ContextCoreConnector ACTIVATED!");
self.placeConnector = [[QLContextPlaceConnector alloc] init];
self.placeConnector.delegate = self;
[self.placeConnector monitorPlacesWhenAllowed];
[self.placeConnector monitorPlacesInBackground];
if ([self.geofenceDelegate respondsToSelector:#selector(startedGeofenceMonitoring)]) {
[self.geofenceDelegate startedGeofenceMonitoring];
}
} failure:^(NSError *error) {
NSLog(#"ContextCoreConnector FAILED!\n%#",error.localizedDescription);
if ([self.geofenceDelegate respondsToSelector:#selector(startedGeofenceMonitoring)]) {
[self.geofenceDelegate startedGeofenceMonitoring];
}
}];

Turns out in the ContextLocation.framework there is a folder called "Resources" and there is a DataModels.bundle file that you need to check the 'Target Membership' in the right side panel of XCode. I had checked all my frameworks as the guides suggested but not that Resources folder.

Related

AFNetworking -[_NSInlineData URL]: unrecognized selector sent to instance

I'm using AFNetworking to connect to WebDAV servers for our iPad app (Easy Annotate).
Most functions and servers work correctly.
However, when creating a directory on one of the test servers, the app terminates with the following message:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_NSInlineData URL]: unrecognized selector sent to instance 0x17cc88a0'
Crash location:
AFWebDAVManager.m
- (void)createDirectoryAtURLString:(NSString *)URLString
withIntermediateDirectories:(BOOL)createIntermediateDirectories
completionHandler:(void (^)(NSURL *directoryURL, NSError *error))completionHandler
{
__weak __typeof(self) weakself = self;
[self MKCOL:URLString success:^(__unused AFHTTPRequestOperation *operation, NSURLResponse *response) {
if (completionHandler) {
if([response.class.description isEqualToString:#"_NSZeroData"]) {
completionHandler(nil, nil);
}
else {
completionHandler([response URL], nil); <-- CRASH !!!
}
}
} ...
'response' (see above) is of type _NSInlineData with value:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>
I've found similar threads, which suggest adding $(inherited) to the 'other linker flags'. This did not solve the issue (or I made a mistake ;))
Any ideas what might cause this crash?
We just had the same issue, it's a typo in the code.
It should be completionHandler([operation.response URL], nil);
Best,
Thomas

Admob get error on Xcode

I developed an app and I want to add Admob.
I can't run Admob test Bannerview.
Code:
// Create a view of the standard size at the top of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
//bannerView_.frame = CGRectMake(0, 200, 320, 50);
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = #"a15188d33246d24";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view2 addSubview:bannerView_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
And the error is:
tableViewKullanimi[13107:c07] <Google> To get test ads on this device, call:
request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];
2013-05-07 17:29:28.154 tableViewKullanimi[13107:c07] -[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0xa360320
2013-05-07 17:29:28.155 tableViewKullanimi[13107:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GADObjectPrivate changeState:]: unrecognized selector sent to instance 0xa360320'
*** First throw call stack:
(0x1ed2012 0x1a85e7e 0x1f5d4bd 0x1ec1bbc 0x1ec194e 0x7cc45 0x7e7c6 0x7c1ae 0x2da1 0xaab1c7 0xaab232 0x9fa3d5 0x9fa76f 0x9fa905 0xfb33ab6 0xa03917 0x9c796c 0x9c894b 0x9d9cb5 0x9dabeb 0x9cc698 0x1d1cdf9 0x1d1cad0 0x1e47bf5 0x1e47962 0x1e78bb6 0x1e77f44 0x1e77e1b 0x9c817a 0x9c9ffc 0x27fd 0x2725)
libc++abi.dylib: terminate called throwing an exception
Add the -all_load flag to "Other Linker Flags" and it should work.
The "test banners" must be enabled in AdMob www

Objective-C errors after getting the IAP product response

This code is from the Phonegap Code: IAP Plugin. The error happens on the line of the code right after the "sent js". All the elements sent to the function are non-nil except for the last one 'nil'. I even logged them out to make sure they were sent. This code is right out of the plugin (https://github.com/usmart/InAppPurchaseManager-EXAMPLE) and has not been modified except for the logging. In the debugger i saw that none of the objects were nil, so i don't understand why the error is happening.
Here is the error:
[__NSArrayI JSONRepresentation]: unrecognized selector sent to
instance 0xdc542d0
2013-02-13 23:26:17.209 GoblinSlots[4519:707] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[__NSArrayI JSONRepresentation]: unrecognized selector sent to
instance 0xdc542d0'
here is the code:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse: (SKProductsResponse *)response
{
NSLog(#"got iap product response");
for (SKProduct *product in response.products) {
NSLog(#"sending js for %#", product.productIdentifier);
NSLog(#" title %#", product.localizedTitle );
NSLog(#" desc%# - %#", product.localizedDescription, product.localizedPrice );
NSArray *callbackArgs = [NSArray arrayWithObjects:
NILABLE(product.productIdentifier),
NILABLE(product.localizedTitle),
NILABLE(product.localizedDescription),
NILABLE(product.localizedPrice),
nil ];
NSLog(#"sent js");
NSString *js = [NSString stringWithFormat:#"%#.apply(plugins.inAppPurchaseManager, %#)", successCallback, [callbackArgs JSONSerialize]];
NSLog(#"js: %#", js);
[command writeJavascript: js];
}
All the stuff to do JSON serialization seems to be already included with the Cordova plugins.
There's no need to download and install yet another JSON library.(a)
It appears that PhoneGap is in the process of switching from SBJson to JSONKit.(b)
PhoneGap is also in the process of changing all the JSON methods to use a "cdvjk_" prefix. (c)
As far as I can tell, something didn't quite go right during those changes.
What I did was edit the file Plugins/InAppPurchaseManager.m , where I made these changes:
Add the line
#import <Cordova/CDVJSON.h>
Replace the line
return [self respondsToSelector:#selector(cdvjk_JSONString)] ? [self cdvjk_JSONString] : [self cdvjk_JSONRepresentation];
with
return [self JSONString];
. (What's the right way to push this or a better bugfix back to the nice PhoneGap people?)
JSONRepresentation is a category that SBJson adds so you have to include SBJson.h in the class that uses it.

iCloud file Upload error (NSFileWriteNoPermissionError = 513)

I'm trying to copy a file to iCloud using the follow code:
NSError *error;
//My Image Source file
NSURL *sourceURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:#"_219" ofType:#"jpg"]isDirectory:NO];
NSLog(#"source: %#", sourceURL);
NSFileManager *fileManager = [NSFileManager defaultManager];
//Discovering iCloud URL
NSURL *iCloudDocumentsURL = [[fileManager URLForUbiquityContainerIdentifier:nil] URLByAppendingPathComponent:#"Documents"];
NSLog(#"iCloudDocumentsURL: %#", iCloudDocumentsURL);
//Setting destination URL
NSURL *destinationURL = [iCloudDocumentsURL URLByAppendingPathComponent:#"image.jpg"];
NSLog(#"destination: %#", destinationURL);
//Copy file to iCloud
BOOL success = [fileManager setUbiquitous:YES itemAtURL:sourceURL destinationURL:destinationURL error:&error];
if (!success) {
#throw [NSException exceptionWithName:[error localizedDescription] reason:[error localizedFailureReason] userInfo:nil];
}
When I run this code I have the following result:
2012-12-31 15:15:30.888 iCloudTest[10614:907] source: file://localhost/var/mobile/Applications/B2202406-BEB8-41B6-A3C4-2327EFB85E54/iCloudTest.app/_219.jpg
2012-12-31 15:15:31.108 iCloudTest[10614:907] iCloudDocumentsURL: file://localhost/private/var/mobile/Library/Mobile%20Documents/xxxxxxxx~com~gazapps~iCloudTest/Documents/
2012-12-31 15:15:31.110 iCloudTest[10614:907] destination: file://localhost/private/var/mobile/Library/Mobile%20Documents/XXXXXXXX~com~gazapps~iCloudTest/Documents/image.jpg
2012-12-31 15:15:31.122 iCloudTest[10614:907] *** Terminating app due to uncaught exception 'The operation couldn’t be completed. (Cocoa error 513.)', reason: '(null)'
*** First throw call stack:
(0x38c312a3 0x32f1897f 0xbb617 0x3a31058d 0x3a350d71 0x3a34cae5 0x3a38e1c9 0xad241 0x3a351ad1 0x3a35165b 0x3a349843 0x3a2f1c39 0x3a2f16cd 0x3a2f111b 0x371295a3 0x371291d3 0x38c06173 0x38c06117 0x38c04f99 0x38b77ebd 0x38b77d49 0x3a34847d 0x3a3452f9 0xacff9 0x3627cb20)
libc++abi.dylib: terminate called throwing an exception
Looking at documentation, Cocoa error 513 means:
NSFileWriteNoPermissionError = 513,
So basically I'm without access to write stuff on iCloud... Looking at https://developer.icloud.com, everything seems to be ok (the documents folder is there).
What I'm doing wrong ?
iCloud has been working intermittently since December 30/31, even though everything may look good on developer.icloud.com. There's a discussion going on at the developer forums here:
https://devforums.apple.com/thread/176739?tstart=0
It's hard to diagnose iCloud issues at this point since it may just be problems on Apple's iCloud server. Some people have noted (on the discussion thread) that iCloud seems to be working better today than prior days so it may be worth testing your app again now.

set file's icon in a command line utility not working

I just began to work with Objective-C and I'm managing pretty well. My last challenge was to make a command line utility, which I could than use in AppleScript. But my code does not work, not in the terminal, not in the AppleScript. So I'm asking you, what's the error in this peace of code, that should be very plain and easy?
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// -imagePath
// -filePath
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];
NSString *soundPath = [args stringForKey:#"imagePath"];
NSString *filePath = [args stringForKey:#"filePath"];
BOOL worked = [[NSWorkspace sharedWorkspace] setIcon:[[NSImage alloc] initWithContentsOfFile:soundPath] forFile:filePath options:0];
NSLog(#"Worked: %i",worked);
[pool release];
return 0;
}
2010-01-31 17:03:24.317 iConChange[14848:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
In effect, that means “You can't do that in a command-line tool”. If you run your tool in the debugger, it'll tell you what “that” is in the stack trace. My guess is that “that” is creating the NSImage.
Another solution is to rewrite the tool to use Icon Services instead of NSWorkspace. The APIs you'll need are still available and not deprecated.
Terminal:
macbook-van-ief2:~ ief2$ /Users/ief2/Desktop/iConChange/build/Debug/iConChange -filePath "~/Desktop/Naamloos.txt" -imagePath "~/Desktop/Z_Home_ZIcon.gif"
2010-01-31 17:03:24.311 iConChange[14848:10b] _NXCreateWindow: error setting window property (1002)
2010-01-31 17:03:24.317 iConChange[14848:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
2010-01-31 17:03:24.322 iConChange[14848:10b] Stack: (
2459177131,
2487344699,
2459176587,
2459176650,
2441787103,
2441786331,
2441785537,
2441784212,
2441781861,
2441794711,
2441793509,
2441762807,
2444980701,
2444978472,
2447881218
)
Trace/BPT trap
2010-01-31 17:03:24.317 iConChange[14848:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
In effect, that means “You can't do that in a command-line tool”. If you run your tool in the debugger, it'll tell you what “that” is in the stack trace.
One solution is to rewrite it as an application. Perhaps a document-based one, with an image view in the document window, set up to receive dragged images and files.
I have an application that uses basically that code to set icons on OS X:
http://pzich.com/junk/Iconizer.app.zip
I'm not sure why yours isn't working.