I am testing Amazon's SimpleDB and downloaded the SDK for IOS
Got a bit frustrated that it doesn't say where to change the endpoint.
The default endpoint is sdb.amazonaws.com
but I would like to change to sdb.ap-southeast-1.amazonaws.com
Does anyone know where I can change this?
Found the solution on this page:
http://aws.amazon.com/articles/CloudFront/3912
In AmazonClientManager.m
sdb = [[AmazonSimpleDBClient alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY]; // existing code
sdb.endpoint = #"http://sdb.ap-southeast-1.amazonaws.com"; // add new line to set the endpoint
It's better to use one of the predefined constants rather than specifying the endpoint via string:
sdb = [[AmazonSimpleDBClient alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
sdb.endpoint = [AmazonEndpoints sdbEndpoint:AP_SOUTHEAST_1];
Related
I am using PSPDFKit framework, and I am unable to add stamp annotation, using this I have implemented following:
[pdfController.annotationStateManager toggleState:PSPDFAnnotationStringStamp];
NSMutableArray<PSPDFStampAnnotation *> *defaultStamps = [NSMutableArray array];
for (NSString *stampSubject in #[#"Great!", #"Stamp", #"Like"]) {
PSPDFStampAnnotation *stamp = [[PSPDFStampAnnotation alloc] initWithSubject:stampSubject];
stamp.boundingBox = CGRectMake(0.f, 0.f, 200.f, 70.f);
[defaultStamps addObject:stamp];
}
PSPDFStampAnnotation *imageStamp = [[PSPDFStampAnnotation alloc] init];
imageStamp.image = [UIImage imageNamed:#"abc.jpg"];
imageStamp.boundingBox = CGRectMake(0.f, 0.f, imageStamp.image.size.width/4.f, imageStamp.image.size.height/4.f);
[defaultStamps addObject:imageStamp];
[PSPDFStampViewController setDefaultStampAnnotations:defaultStamps];
but I have no output.
Peter here, Founder and CEO of PSPDFKit, the PDF SDK for iOS, Android, Web, macOS and (soon) Windows. The best way to reach our support is reaching out directly to our support page. Support is part of your license subscription.
You're setting default stamps for the PSPDFStampViewController. Can you post a screenshot how things look? You're changing the default here (APPROVED, REJECTED and so on and replacing this with your own images, which is valid and works.)
Note that you only need to call this once and it needs to be called before you switch/toggle the stamp mode, so your current code will not work.
Please also make sure you use the latest version so we can rule out any old bugs or incompatibilities. As of writing this, it's Xcode 8.3 and PSPDFKit 6.6 (click for release blog post).
Stamps only show up if you have the annotation component licensed - if you ping us on support my team can check what components you have to make sure that's not the problem here.
If you're just trying to programmatically add annotations via our framework, check out this guide article instead.
I am trying to play youtube video in my application. everything works fine. but when i am trying to watch video that contains content from youtube. it fails.
I researched found one think that you should encrypt and decrypt signature and add this to the URL?
I dont know how to decrypt signature in IOS?
http://www.youtube.com/get_video_info?video_id=uuZE_IRwLNI&el=vevo&ps=default&eurl=&gl=US&hl=en
stream
{
"fallback_host" = "tc.v12.cache7.googlevideo.com";
itag = 22;
quality = hd720;
s = "8E6E5D13EB65FB653B173B94CB0BCC3A20853F5EDE8.5E2E87DF33EEDE165FEA90109D3C7D5DADA06B6BB60";
type = "video/mp4; codecs=\"avc1.64001F, mp4a.40.2\"";
url = "http://r7---sn-cvh7zn7r.googlevideo.com/videoplayback?pcm2fr=yes&sver=3&expire=1393773646&itag=22&id=bae644fc84702cd2&upn=SjZd81MudQs&sparams=gcr%2Cid%2Cip%2Cipbits%2Citag%2Cpcm2fr%2Cratebypass%2Csource%2Cupn%2Cexpire&ms=au&gcr=in&mt=1393747698&source=youtube&ratebypass=yes&ipbits=0&fexp=935620%2C919120%2C912523%2C932288%2C914084%2C916626%2C937417%2C937416%2C913434%2C932289%2C936910%2C936913%2C902907&mv=m&key=yt5&ip=103.250.162.79";
}
When i use url its not playing. is there any solution?
You can't just use get_video_info data alone, you also need to download the main video page in order to see which html5player-XXXXX.js javascript file is loaded. This will dictate which permutations are needed. See http://www.jwz.org/hacks/youtubedown (written in Perl) as an example -- skip to the section that says "This is not crypto or a hash, just a character-rearrangement cipher. Total security through obscurity. Total dick move.", which is a sentiment I heartily concur with.
The XCDYouTubeKit library does this with a very simple API for you to use.
NSString *videoIdentifier = #"uuZE_IRwLNI";
[[XCDYouTubeClient defaultClient] getVideoWithIdentifier:videoIdentifier completionHandler:^(XCDYouTubeVideo *video, NSError *error) {
if (video)
{
// All URLs, with decrypted signature, are available in the `video.streamURLs` dictionary
}
else
{
// Handle error
}
}];
Disclaimer: I’m the author of XCDYouTubeKit.
A little shameless self promotion, I spent the last few weeks figuring out how the alternative JavaScript and perl versions of software did this, initially used JavaScriptCore to accomplish it, but decided I wanted a pure obj-C sample, so I made one myself. There is exhaustive commenting on how it all works in the main file.
https://github.com/lechium/yourTube/blob/master/yourTube/KBYourTube.m
KBYourTube *tube = [[KBYourTube alloc] init];
NSArray *streamArray = [tube getVideoStreamsForID:#"_7nYuyfkjCk"];
Will return
{
"fallback_host" = "tc.v20.cache6.googlevideo.com";
format = "720p MP4";
itag = 22;
quality = hd720;
s = "771171A2777DE13D6CE5320C210DCCA29F018FC6DBA.A7630D3C26F2F70EEFEB25889E1A1B8805EC0616616";
title = "Lil+Wayne+-+She+Will+ft.+Drake";
type = "video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22";
url = "https://r15---sn-bvvbax-2iml.googlevideo.com/videoplayback?nh=EAI&fexp=9416126%2C9420452%2C9422596%2C9423662%2C9424859&ipbits=0&mime=video%2Fmp4&ratebypass=yes&itag=22&upn=8XDeh70fkMI&expire=1450776595&mt=1450754946&sparams=dur%2Cid%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&key=yt6&id=o-AF5K6y8liVQ1S9iLjUHOcIBdnb4a8g-rgcFwGc0wuidq&mn=sn-bvvbax-2iml&mm=31&ms=au&mv=m&source=youtube&pl=16&dur=323.895&lmt=1417236324599143&ip=xx&requiressl=yes&sver=3&signature=671A2777DE73D6CE5320C210DCCA29F018FC1DBA.A7630D3C26F2F70EEFEB25889E1A1B8805EC0616&title=Lil+Wayne+-+She+Will+ft.+Drake";
},
This should be able to fully supplant any way you are currently getting details about a video for download / playback purposes and takes care of the signature deciphering for you. You could also pretty easily modify the code to JUST use it for signature deciphering (but you would need to take care to use the proper timestamp value when using get_video_info).
I have a python webservice running locally using GAE Python SDK 1.8.3. After annotating the API and generating iOS client classes using Google Cloud Endpoints Service Generator I'm trying to call a remote procedure using it.
If I test my api using API Explorer, everything works just fine.
When I call using the iOS client, the call is received by the webservice, however the request cannot be decoded correctly. This is my first time using the Endpoints API so I don't know what is wrong.
What seems to be happening is that my request object is being wrapped in a "resource" key in the query JSON. Now, when my webservice tries to decode it, it yields a warning saying "No variant found for unrecognized field: resource". And, as my object is wrapped inside this key, it is skipped and never decoded to a message.
When the call is made using the API Explorer the object is not wrapped, so everything works.
This is what I'm doing in my webservice:
#endpoints.method(SearchRequest,
ContactListResponse,
path='search', http_method='post',
name='api.search')
def search(self, request):
user = request.user
number = request.number
This is how I call it from iOS:
GTLMyAPIMessagesSearchRequest * request = [[GTLMyAPIMessagesSearchRequest alloc] init];
request.user = #"+552199881234";
request.number = #"+5521717171";
GTLQueryMyAPI *query = [GTLQueryMyAPI queryForApiSearchWithObject:request];
[service executeQuery:query completionHandler:^(GTLServiceTicket *ticket,
GTLMyAPIMessagesContactListResponse* object,
NSError *error)
{
NSArray* contacts = object.contacts;
}
Am I doing anything incredibly wrong here?
This is an annoying bug from iOS to Endpoints for local testing. I hope they fix it soon. :)
BTW instead of modifying QGTQueryMyAPI.m (which is a generated file). I do Theo's fix just after I create the query instead. So all of my queries that send data look like this (and I set that one flag to switch from localhost to deployed in other places too).
GTLQueryMyApi *query = [GTLQueryMyApi queryForSearchWithObject:someGtlObject];
if (LOCAL_HOST_TESTING) {
[query setJSON:someGtlObject.JSON];
}
This is not a great solution but a patch for now. I have the same problem when doing iOS endpoints localhost testing. However when I use the deployed backend I remove this line and everything is fine.
auth.shouldAuthorizeAllRequests = YES;
The "resource" key wrapping issue only happens when I add the line above to use localhost. So this morning I'm not using localhost, just the deployed version. Let me know if you fix the issue. :) Obviously pointing to the deployed version is not preferred for testing.
Alright! user2697002's answer showed me that this works when the webservice is deployed.
For development to work correctly this is the workaround I did.
The generated API uses a template like this for all queries in GTLQueryMyAPI.m
+ (id)queryForSearchWithObject:(GTLMyAPIMessagesSearchRequest *)object {
if (object == nil) {
GTL_DEBUG_ASSERT(object != nil, #"%# got a nil object", NSStringFromSelector(_cmd));
return nil;
}
NSString *methodName = #"myapi.search";
GTLQueryMyAPI *query = [self queryWithMethodName:methodName];
query.bodyObject = object;
query.expectedObjectClass = [GTLMyAPIMessagesContactListResponse class];
return query;
}
For this to work on development server one could substitute all these lines
query.bodyObject = object;
With
query.JSON = object.JSON;
This stops from wrapping the JSON in a "resource" field. Somehow I believe this shouldn't be done on deployment release version.
I'm still experimenting but believe this is the proper way (swift) to set up for testing on localhost....
let _service = GTLServiceBackendAPI();
_service.allowInsecureQueries = true;
_service.isRESTDataWrapperRequired = false;
_service.retryEnabled = true;
_service.fetcherService.allowLocalhostRequest = true;
_service.rpcURL = NSURL(string: "http://localhost:8080/_ah/api/rpc?prettyPrint=true")
I am using OData4ObjC, want to know is there a way to add/update/delete an entry in a table without using proxy classes. Just similar way the OData4j for Android does
e.g.,
OEntity havinaCola = c.getEntity("Products", 3).execute();
I am currently using proxy classes for the same as mentioned below,
proxy = [[serviceEntities alloc] initWithUri:#"sampleservices/producer.svc/" credential:nil];
QueryOperationResponse *response = [proxy execute:#"customers"];
NSMutableArray *array = [response getResult];
Thanks.
I have found one way to do the same i.e., as mentioned in the book written by Author 'Matthew Baxter-Reynolds' 'Multimobile Development (Building applications for the iPhone and Android Platform)' suggests method how to GET/UPDATE/DELETE/ADD entries.
Hope this is useful.
Thanks
I've been struggling with connecting to the AWS DynamoDB with my iOS app. I am frustrated with the lack of tutorials/documentation on the DynamoDB (I guess it is still fairly new). But I ahve been trying to follow Amazon's User Preference Tutorial I am trying to just connect to the database and read something or write something but I am getting an exception thrown.
AmazonCredentials *creds;
creds = [creds initWithAccessKey:MY_ACCESS_KEY withSecretKey:MY_SECRET_KEY];
AmazonDynamoDBClient *ddb = [[AmazonDynamoDBClient alloc] initWithCredentials:creds];
DynamoDBGetItemRequest *request = [[DynamoDBGetItemRequest alloc]
initWithTableName:#"Users" andKey:[[DynamoDBKey alloc] initWithHashKeyElement:
[[DynamoDBAttributeValue alloc] initWithS:#"Chase"]]];
DynamoDBGetItemResponse *response = [ddb getItem:request]; //THROWING THE EXCEPTION HERE!
NSMutableDictionary *user = response.item;
NSLog(#"%#",user);
The output reads:
Terminating app due to uncaught exception 'AmazonServiceException', reason: ''
The only thing that I changed from what the tutorial has done is the way I set up my user credentials and the line that throws the exception, the tutorial has:
DynamoDBCreateTableResponse *response = [[AmazonClientManager ddb] getItem:request];
I couldn't find any AmazonClientManager class anywhere, but the AmazonDynamoDBClient class seems to have the same method, so I am assuming that it should work (this could very well be the assumption that is breaking my code). I don't know if Amazon still supports that class because I can't find it in any documentation either.
Also, before I get yelled at, I know that I shouldn't be handing out my own credentials in the app. I will change this later. I am just trying to get to a sanity state for now.
You need to change these lines
AmazonCredentials *creds;
creds = [creds initWithAccessKey:MY_ACCESS_KEY withSecretKey:MY_SECRET_KEY];
to this
AmazonCredentials *creds = [[AmazonCredentials alloc] initWithAccessKey:MY_ACCESS_KEY withSecretKey:MY_SECRET_KEY];
Also, AmazonClientManager is not a part of the SDK. It's a part of the sample app and returns an instance of AmazonDynamoDBClient. It's included in the sample project.