Hi there,
When I navigate from the root view to another view, it works. However, when I want to get back, the navigation button links to itself. This goes on for about 6 taps, until it eventually goes back to the root view.
This only occurs on one view, and the rest are working fine.
I have no idea what code is causing this, but if you need any code, I will amend this post with it. Just ask for it.
Thanks a lot,
Jack.
Currently I am loading my supported products from a plist and after that I send a SKProductsRequest to guarantee that my SKProducts are still valid.
So I set up the request, start it and get the response in:
(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
Now, so far all functions correctly.
Problem: From calling the request until receiving the response it may last several seconds. Until that my app is already loaded and the user may be able to choose and buy a product.
But because no products have been received, the available products are not in sync with the validated products - unlikely, but possible error.
So my idea is to wait until the data is loaded and only continue when the list is validated.
(Just a few seconds waiting...). I have a singleton instance managing all products.
+ (MyClass *) sharedInstance
{
if (!sharedInstance)
sharedInstance = [MyClass new];
// Now wait until we have our data
[condition lock];
while (noEntriesYet) // is yes at begin
[condition wait];
[condition unlock];
return sharedInstance;
}
- productsRequest: didReceiveResponse:
{
[condition lock];
// I have my data
noEntriesYet = false;
[condition signal];
[condition unlock];
}
Problem: The app freezes. Everything works fine if didReceiveResponse is completed before
the sharedInstance is queried. There are different threads, the lock is working if
wait is reached during didReceiveResponse, everything fine. But if not, didReceiveResponse
is never called even if the request was sent.
The lock is released, everything looks ok. I have tried to send the product request in a separate NSThread, with NSOperationQueue...without avail.
Why ? What is happening ?
How to solve the problem ?
Is there any ready made class/formula somewhere I can use it for control my viewpoint by accelerometer's/compass's XYZ?
I want to achieve the same view control like acrossair uses.
I have the parts (OpenGL space, filtered accel-, compass values, and a cubic panoramic view mapped to a cube around my origin).
Can somebody suggest me where to start at least?
Seems like a simple thing but I can't seem to find a way to do it.
I saw this but it doesn't seem to work:
NSDate *date = [NSDate dateWithNaturalLanguageString:@"07/17/07"];
It would be great to see a couple different methods.
Thanks,
Nick
Hi
I have to do some different views containing 72 LED lights. I built an LED Class so I can loop through the LED's and set them to different colors (Green, Red, Orange, Blue None etc.).
The LED then loads the appropriate .png.
This works fine, I loop over the LED's and set them.
Now I know that at some time they will need to not just turn on/off change color, but will have to turn on with a small delay. Like an equalizer.
I have a 5-10 views containing the 72 LED's and I would like to achieve the above with the minimum amount of memory/CPU strain.
for(LED *l in self.ledArray) {
[l display:Green];
}
I simply loop as shown above and inside the LED is a switch case that does the correct logic.
If this were actual LED's and a microController I would use sleep(100) or similar in the loop, but I would really like to avoid stuff like that for obvious reasons.
I was thinking that doing a performOnThread withDelay would really be consuming, so would UIView animation changing the alpha and NSOperation would also be a lot of lifting for a small feature.
Is there a both efficient and clever way to go around this?
Thanks for any inspiration given:)
Hi, I am trying to set up an application in which users will be able to stream music. When the user is streaming a MP3, I'd like to set up a link to the iTunes store to buy the MP3.
How can I do that? I feel like there should be some simple way of doing so using the song title and artist name, am I mistaking?
Thanks
I need to work with private HTTPS API and client has incorrect certificate on the host.
Certificate is for www.clienthost.com and I'm working with api.clienthost.com.
So I need to connect via HTTPS to api.clienthost.com ignoring incorrect certificate but still make sure it is the one for www.clienthost.com and not something else.
I found this answer: http://stackoverflow.com/questions/933331/how-to-use-nsurlconnection-to-connect-with-ssl-for-an-untrusted-cert and it seems to solve half of my problem but I'm trying to figure out how to still check certificate for host is one I expect to see and not different.
Does someone knows how we can combine our current recording into another background playing music? I need some sample code for this. I want to create something like karaoke application in which we can record our voice over an instrumental music.
I have a NSManagedObjectContext in which I have a number of subclasses of NSManagedObjects such that some are containers for others. What I'd like to do is watch a top-level object to be notified of any changes to any of its properties, associations, or the properties/associations of any of the objects it contains.
Using the context's 'hasChanges' doesn't give me enough granularity. The objects 'isUpdated' method only applies to the given object (and not anything in its associations). Is there a convenient (perhaps, KVO-based) was I can observe changes in a context that are limited to a subgraph?
I feel worry when i read "company name cannot be edited once submitted."
Is it possible that i submit my developer name duplicate to other? (same name)
I do not want my developer name duplicate to other.
Sorry for my english.
We are caching images downloaded from our server. We write them to our local storage like this:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0] ;
NSString* folder = [[documentsDirectory stringByAppendingPathComponent:@"flook.images"] retain];
NSString* fileName = [folder stringByAppendingFormat:@"/%@", aBaseFilename];
BOOL writeSuccess = [anImageData writeToFile:fileName atomically:NO];
The downloaded images are always the expected size, around 45-85KB.
Later, we read images from our cache like this:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0] ;
NSString* folder = [[documentsDirectory stringByAppendingPathComponent:@"flook.images"] retain];
NSString* fileName = [folder stringByAppendingFormat:@"/%@", aBaseFilename];
image = [UIImage imageWithContentsOfFile:fileName];
Occasionally, the images returned from this cache read are much smaller because they are much more compressed - around 5-10KB. Has the OS done this to us?
It is my understanding that currently if you use UIImagePicker to grab a photo, it passes back back a UIImage object which doesn't include any of the geotagging information. I was wondering if it's confirmed that in OS 4 this is fixed? Or any suggestions on where to go look to see if this is fixed?
Thanks, Mark
Hi guys,
Little background, the table view is filled by a fetchedResultsController which fills the table view with Strings. Now I'm trying to add a button next to each String in each tableview cell. So far, I've been trying to create a button in my configureCell:atIndexPath method and then add that button as a subview to the table cell's content view, but for some reason the buttons do not show up. Below is the relevant code. If anyone wants more code posted, just ask and I'll put up whatever you want. Any help is greatly appreciated.
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
// get object that has the string that will be put in the table cell
Task *task = [fetchedResultsController objectAtIndexPath:indexPath];
//make button
UIButton *button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
[button setTitle:@"Check" forState:UIControlStateNormal];
[button setTitle:@"Checked" forState:UIControlStateHighlighted];
//set the table cell text equal to the object's property
cell.textLabel.text = [task taskName];
//addbutton as a subview
[cell.contentView addSubview:button];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
I want to pass a flag into my location manager function
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
so it will look like
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation andTweet:(Bool *)tweet
but it started with the command
[locmanager stopUpdatingLocation];
So how can I pass the bool into the function?
I am modifying the "MoveMe" example from the apple web site. When I get the "touchesMoved" message I move the centre of the target view to the centre of the touch.
Is there a way that when the touch starts ("touchesBegan" message) I can remember the offset from the target view and keep that offset.
Let me know if this is hard to understand and I will try to explain it a bit better.
Hi i am developing an app for my QA department. I need to programically get how many phone numbers are there in the entire address book. No user input. Just click a button and then get how many phonenumbers are there in the ENTIRE addressbook.
Please email me at [email protected]
I used core data to do this:
NSManagedObjectContext *m = [self managedObjectContext];
Foo *f = (Foo *)[NSEntityDescription insertNewObjectForEntityForName:@"Foo"
inManagedObjectContext:m];
f.created_at = [NSDate date];
[m insertObject:f];
NSError *error;
[m save:&error];
Where the created_at field is defined as type "Date" in the xcdatamodel.
When I export the sql from the sqlite database it created, created_at is defined as type "timestamp" and the values look like:
290902422.72624
Nine digits before the . and then some fraction.
What is this format? It's not epoch time and it's not julianday format.
Epoch would be:
1269280338.81213
julianday would be:
2455278.236746875 (notice only 7 digits before the . not 9 like I have)
How can I convert a number like 290902422.72624 to epoch time? Thanks!
I feel like this should be obvious to me, but for some reason I can't figure this out. I have a navigation interface with nav bar, tool bar, and primary view. Sometimes the user takes an action that causes a progress indicator to appear in the middle of the view.
While the progress indicator (which is a custom UIView) in spinning in the middle, I want no touch input to be allowed to go to any of the underlying interface (main view, nav bar, toolbar, etc). But this doesn't seem trivial.
I've tried (and failed) to create a simple view whose only job is to swallow touch input and use it as a window subview-- no dice, it never gets the touch events (and yes, it does have userInteractionEnabled). I've tried to bolt it on as a transparent modal view controller, but those don't seem to ever be transparent.
Thoughts? What am I missing?
Thanks!
Have: xCode project with Google Analytics lib, could be normally compiled. Want just to put it to already working SVN to build project from the work macosx without any additional steps.
I've tried different ways to add *.a file to the svn, but all just have not worked. When adding a directory there is all files except *.a in the svn.
I bet there is not such problem with 3d party SVN clients, but want to give the xCode one more chance, so asking there.
Guys, is it possible to add *.a files to SVN using xCode?
Hi there,
I'm using ASIHTTP Request to get a NSString response that I give to a SBJSON parser.
The problem is that inside the NSString response I got some UTF8 encoded character (accent) that I need do decode to make the app works.
How can I decode UTF8 with JSON?
I call the JSON message like this:
[jsonParser objectWithString:jsonString error:NULL];
Any help would be so appreciated.
Fabrizio
Does anyone know how to get the size in pixels or scale value of the viewport after a user has pinched or double tapped to zoom in/out on a page in JavaScript?
I've tried using window.innerWidth but I've had mixed results. Sometimes it seems to accurately give the number of pixels the viewport is showing, however, if I zoom way in on a page and then do a large pinch to zoom back out, window.innerWidth will be around 600-700 even though it is only showing ~200px of the page. The page is only 400px wide and it didn't show the checkered "you've gone too far" background you see when you zoom out beyond the page size.
If I do small pinches to zoom in and out, window.innerWidth appears to work just fine. Unfortunately I can't rely on a user only making small pinch gestures :)
I've also tried to use the scale property on the gesture event object, but I've found that unreliable because you don't always know the initial scale when you reload the page or use back/forward buttons to navigate to it even when using the meta tag to specify it.
Ultimately, I'm trying to make an app that is aware of when a user is trying to zoom out beyond the maximum zoom level so if there is another way to do this I'm interested in hearing about it :)
Here's the code I'm using to get the innerWidth:
document.body.addEventListener('gestureend', function (evt) {
console.log(window.innerWidth); // inaccurate when doing large pinch gestures
}, false);
Thanks!
I have a simple UITableView setup. I am trying to use
- (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item
I put a NSLog inside this method, but it is apparently not getting called when I "pop" back to the screen. I am not finding much information about this function, has it been replaced?