I am trying to build a mini-application to codesign one Mac OS X application with codesign utility and my developer certificate in keychain. To do that I use NSTask, like that :
[task setLaunchPath:#"/usr/bin/codesign"];
// ...
NSString *certificateName = #"\"3rd Party Mac Developer Application: Firstname Lastname\"";
NSString *appName = #"\"/path/to/My App.app\"";
NSArray *args = [NSArray arrayWithObjects:#"-s", certificateName, appName, nil];
// ...
[task launch];
I use a NSPipe to catch the output and I got this error message : no identity found...
But if I launch this command manually via Terminal, the application is well signed (so it's not a problem of certificate badly installed, etc).
I think issue comes because my application can't access the certificate in keychain (but me I can via Terminal).
Does someone already experienced this problem ?
Thanks in advance, Best.
You should not embed additional quotation marks in the arguments to NSTask:
NSString *certificateName = #"3rd Party Mac Developer Application: Firstname Lastname";
NSString *appName = #"/path/to/My App.app";
Spaces in the arguments are handled automatically, and do not require quotation marks.
Related
I have an app with the following code:
NSURL *containerURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:#"group.com.myCo.myApp"];
[containerURL URLByAppendingPathComponent:#"Myfile"]];
Reading and writing from Myfile is working, but I'd like to be able to access the file directly on my phone for debugging and testing purposes.
It's not in App's container (Window > Devices >> Download container), is it really not accessible to developers who have the device attached to the computer? I feel like I'm missing something here?
Is there any reverse proxy that can be embedded within OSX application written in Objective-C? I need to develop application which is going to have reverse proxy embedded inside but not to use an external proxy server instance. Did someone used Nginx that way?
It's technically possible. I think your idea of using Nginx would work. Why did you call out Objective-C specifically? I don't see why you wouldn't use one written in plain C (there should be no problem with that). You might consider using a separate process space for the proxy, otherwise your app and the proxy might interfere with each other in ways you don't expect. (like calling exit(), handling signals, crashing, etc) Then you don't have to figure out how to recompile the proxy inside Xcode, etc - you just have a binary for it and you configure and run it.
The question is, why would you do it? Reverse proxies only make sense when you have a backing server farm to connect to. Do you just need an embedded web server to serve up pages to your application? Why not just use one directly? A reverse proxy would just complicate things.
It seems that there is no reverse proxy written in Objective-C :)
Solution I used is:
Download nginx source code
Configure using
./configure --sbin-path=/usr/local/nginx
--conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/nginx/src/$PCRE_FILE/ --group=www --user=www --with-http_stub_status_module --with-http_gzip_static_module --prefix=/usr/local/nginx
copy binary into boundle
run binary using
NSTask *task = [[NSTask alloc] init];
NSPipe * out = [NSPipe pipe];
[task setStandardOutput:out];
[task setLaunchPath:[NSString stringWithFormat:#"%#/Library/run/nginx", appPath]];
[task setArguments:#[#"-c", [NSString stringWithFormat:#"%#/Library/conf/nginx/nginx.conf", appPath], #"-p", [NSString stringWithFormat:#"%#/Library/nginx", appPath]]];
[task launch];
[task waitUntilExit];
read = [out fileHandleForReading];
dataRead = [read readDataToEndOfFile];
stringRead = [[NSString alloc] initWithData:dataRead encoding:NSUTF8StringEncoding];
NSLog(#"output: %#", stringRead);
My Mac application in Xcode has recently begun exhibiting strange symptoms when attempting to access iCloud. There haven't been any changes to my provisioning profiles, code signing identities, etc.
However, when running this code:
id token = [fileManager ubiquityIdentityToken];
NSLog(#"Token is: %#", token);
NSURL *iCloudURL = [fileManager URLForUbiquityContainerIdentifier:nil];
NSLog(#"iCloud URL is: %#", iCloudURL);
The output is:
2013-10-28 08:17:12.372 MyApp[21101:303] Token is: (null)
2013-10-28 08:17:12.373 MyApp[21101:303] iCloud URL is: (null)
Which I find extremely strange, especially considering I am actually signed into iCloud on this machine. To be sure, I ran a quick test with Calendar, adding an event on an iPhone and ensuring that it showed up on the Calendar on my Mac.
But I was under the impression that [fileManager ubiquityIdentityToken]; would return whether the user was logged into iCloud, regardless of whether your entitlements, code signing, etc. was properly configured - indicating that it's less an issue on my end, and more an issue of the system's ability to return this value.
I have tried logging out (and back in) to iCloud, and have ensured that "Documents & Data" is enabled in the iCloud settings.
This was resolved by upgrading from the original Mavericks GM (build 13A598) to the official release (build 13A603.)
I'm setting up In-App purchasing for my Mac App. I currently am able to get the product from iTunes Connect, and even request a purchase. I'm pretty stumped with this error message, and am really hoping someone has been here before and can offer some assistance.
I am getting the (very helpful) localized error: Transaction error: Unknown Error.
I've included the two images of successful Mac App Store authentication, and error message. All I'm able to figure out is that the failedTransaction is being called from the SKPaymentTransaction.
Here's what I did. Archive in Xcode. Then distribute -> mac installer -> double-click .pkg file & install.
That seems to download the _MASReceipt and all is well when including
if(![[NSFileManager defaultManager] fileExistsAtPath:[[[NSBundle mainBundle] appStoreReceiptURL] path]]) {
NSLog(#"to get sandbox receipt, the app must be launched from outside xcode");
exit(173);
}
I am using AFNetworking to connect from an iOS v6.0 app to my local Cold Fusion 8 server, not on the same machine but on the same network and the connection times out. When I use an external public server it works fine.
I have tried the connection via IP address and it doesn't work.
I have tried an entry in the hosts file assigning a domain name to the IP address and this doesn't work either. Please see the error below.
I can however connect via a web browser just fine.
Also, the server side files are exactly the same. Versions of Cold Fusion are the same. The only difference that I can find are the public server is Win2003 with IIS6 and the local server is Windows7 with IIS7.
Any thoughts on why this would not work on a local network. Makes local development kind of difficult.
Here is the relevant code:
// load params
NSMutableDictionary *myParams = [[NSMutableDictionary alloc] init];
[myParams setValue:#"Hello" forKey:#"Parameter1"];
[myParams setValue:#"There" forKey:#"Parameter2"];
// Load the base URL into a URL object
// Changing this to an external public server works fine
NSURL *baseURL = [NSURL URLWithString:#"http://www.mylocalmachine.com/"];
// Create HTTP client and init with base url
AFHTTPClient *myHttpClient = [[AFHTTPClient alloc] initWithBaseURL:baseURL];
// POST request to path with the parameters
NSMutableURLRequest *myRequest = [myHttpClient requestWithMethod:#"POST" path:#"myfile.cfm" parameters:myParams];
// Block response from the HTTP client request and pass it back to the calling object
AFJSONRequestOperation *myOperation = [AFJSONRequestOperation JSONRequestOperationWithRequest:myRequest
success:^(NSURLRequest *mySuccessRequest, NSHTTPURLResponse *mySuccessResponse, id mySuccessJSON)
{
// PROCESS THE SUCCESS RESPONSE;
}
failure:^(NSURLRequest *myFailureRequest, NSHTTPURLResponse *myFailureResponse, NSError *myFaliureError, id myFailureJSON)
{
// PROCESS THE FAILURE RESPONSE... AFTER 60 seconds the system will fallout to this block.
}];
// Create a queue object
NSOperationQueue *myQueue = [[NSOperationQueue alloc] init];
// Add the operation object to the queue
[myQueue addOperation:myOperation];
The following is the error I get print the myFailureError object
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x8481000 {NSErrorFailingURLStringKey=http://www.mylocalmachine.int/myfile.cfm, NSErrorFailingURLKey=http://www.mylocalmachine.int/myfile.cfm, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x9189e20 "The request timed out."}
Update----
I believe I have narrowed the issue down to what I beleive to be an issue with the iPhone simulator accessing IIS 7. It will access previous versions of IIS on the same network using the same code no problem.
The problem may be in the iPhone Simulator's User-Agent. I have tried to find a way to change the iPhone Simulator's User-Agent or allow the User-Agent in IIS 7 but can not seem to figure it out. The User-Agent the iPhone Simulator 6 is presenting is (iPhone Simulator; ios 6.0; Scale/2.00).
Does anyone know how to either allow this User-Agent on IIS 7 or change the User-Agent in the iPhone simulator?
Has anyone else seen this issue?
Thanks in advance,
Ed
Update----
Hi Everyone
Ok so I figured out how to change the User-Agent and Content-Type using the NSMutableURLRequest. I changed these to match what the browser would send, FireFox browser, and tried again to no avail. I still believe there is an issue with the configuration of IIS 7.5 but I can not find it...
Thanks for anyones help!!!
Ed
please try to remove last 2 lines of code and write
remove this
NSOperationQueue *myQueue = [[NSOperationQueue alloc] init];
[myQueue addOperation:myOperation];
add this instead
[myoperation start];
and also write failure:nil before that ending square bracket(]) like
AFJSONRequestOperation *myOperation = [AFJSONRequestOperation JSONRequestOperationWithRequest:myRequest
success:^(NSURLRequest *mySuccessRequest, NSHTTPURLResponse *mySuccessResponse, id mySuccessJSON)
{
// PROCESS THE SUCCESS RESPONSE;
}
failure:^(NSURLRequest *myFailureRequest, NSHTTPURLResponse *myFailureResponse, NSError *myFaliureError, id myFailureJSON)
{
// PROCESS THE FAILURE RESPONSE... AFTER 60 seconds the system will fallout to this block.
}failure:nil];
let me know is it working or not...!!!!
Happy Coding!!!!!!
I have resolved this issue. I will post what the resolution was to hopefully help someone else with a similar issue.
Turns out the problem was AVG installed on the system that was running IIS 7. It was a difficult issue to determine because any other system could access the web server with out any problems. It was only specific with the iPhone simulator accessing the system running IIS7. Even Safari or FireFox running on the same Mac would work just fine. Now what within AVG was causing the problem... That is yet to be determined.
I truly hope this helps someone along the way!