Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - runartrollet

Pages: [1]
1
"How To" Topics / [Resolved]Need help fast with user keyboard
« on: August 23, 2014, 10:46:12 AM »
Hi, I've been having a game out for a while now. It is suddenly soaring in popularity across the globe. I few users are reporting an error which I am unable to replicate. The error occurs when the user has ended his game, and entered his or hers name for the leaderboard. The keyboard does not hide after the input- This is a rare error which I cannot replicate at all on any of my devices. I have everything, and cannot see any reason why it should do this. It is just beyond me. If anybody could help me out here, that would be really good, as I want to fix this before any more users notices it.

My code is here: http://pastebin.com/tLbP4u9x

2
Book 3: Mastering Xcode and Swift / Managing change in datamodel
« on: June 10, 2014, 12:13:09 PM »
Hi. I did read chapter 12 about managing change, and I have copied your mmBusinessObject and such, which works quite good. But now I needed to change the data model, and I thought it was going to perform the automatic lightweight changes, and fix it. It does run the code, but then crashes while saving. I did only add one argument to the data-entity. For now, I have fixed this by just renaming the database, but this causes me to lose all the info. What could be causing the crash?

Code: [Select]
NSPersistentStoreCoordinator has no persistent stores.  It cannot perform a save operation.'

3
Book 3: Mastering Xcode and Swift / Creating entities problem.
« on: June 09, 2014, 07:21:55 AM »
Hi.

(just to start, I might be using the wrong terms here. By entities i mean each new line of data inside the sql-file.)
I just got very confused on how to create entieties. I've set up core data to fetch from the database, create new entities if there are none, and populate with default data. However, now I am implementing a highscore-view, which requires multiple entities, one for each score submitted. I have tried a few different options of the code, but either I am adding the new score and a empty entity, or I am just saving the score over one of the preexisting scores. Could you have a look at it?

Code: [Select]
    [highscore createEntity];
    [highscore saveEntities];
    allUserHighScores = [highscore getAllEntities];
    userHighScore = [allUserHighScores lastObject];
    userHighScore.score = userGame.score;
    userHighScore.values = userGame.values;
    [highscore saveEntities];

4
Hi, I recently got a error with Core data in my app. The crash only happens if I keep going from one view to another many times, which refreshes the data. I saw something on stack overflow about it here: http://stackoverflow.com/questions/18870387/core-data-and-ios-7-different-behavior-of-persistent-store/18870738#18870738

I am unable to understand much of this, really, so I thought I should ask here. Am I accessing the database too many times, or do I need to take some measures to ensure this works with ios7 ?

Thanks

5
"How To" Topics / Memory management
« on: April 09, 2014, 03:41:02 AM »
I have just a quick question here. In my app, I have a container-view, which displays different views, going back and forth many times. I noticed that the memory slowly gets eaten up for every time I go back and forth between views, even if they are the same ones. So I thought I should add some code to release the views. Then I read from some sources on stack overflow, that I should just leave it and IOS will handle it, and release views not needed anymore when the memory gets low. Others say I need to write code.

Currently, my app is just using 12mb, and rising by about 1mb for every time I change the view. Since this is a game, it will happen quite a lot. And the game will also become bigger in size.

What is your view on this?

Thanks.

6
"How To" Topics / Container Views
« on: April 02, 2014, 08:09:53 AM »
Hi, I am trying to build an iPad game. Right now I am just trying to get a grip of everything in Xcode. I am thinking of having navigational buttons around the edge of the screen, with a separate container view which changes depending on which button the player presses around the edge of the screen. This container can hold different items, like images, buttons and tables. At this point I am trying to have just a table view, populated dynamlicly. However, I don't quite understand how to call the tableview inside the container, and if I should give the container its own UIViewController -class. I've tried searching the new for this, but I wan unable to find what I was looking for.

In short I want to:
Populate a table view inside a container.

Any help would be appreciated.

7
Hi, i keep getting the error "Invalid argument type 'NSString' to unary expression' when following step two. I am sure the code is identical to yours, I even did a copy/paste from the book. I believe i may have misunderstood where the code should be placed though. Maybe you could clarify? I've attached a photo of the code, as well as the code in text-format. It is the top NSString that is causing an issue.

Code: [Select]
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    - (NSString *)tableView:(UITableView *)
tableView titleForHeaderInSection:
(NSInteger)section {
       
        switch (section) {
            case 0:
                return @"Customer Information";
                break;
               
            case 1:
                return @"Shipment Detail";
                break;
            default:
                return nil;
        }
    }
   
    - (NSString *)tableView:(UITableView *)
tableView titleForFooterInSection:
(NSInteger)section {
        switch (section) {
            case 0:
                return @"Be kind and courteous!";
                break;
            default:
                return nil;
                break;
        }
    }
   
   
    UITableViewCell *cell;

   
    // Configure the cell...
    if (indexPath.section == 0) {
        switch (indexPath.row) {
            case 0:
                cell = [tableView dequeueReusableCellWithIdentifier:@"NameCell" forIndexPath:indexPath];
                cell.textLabel.text = self.shipmentEntity.name;
                break;
            case 1:
                cell = [tableView dequeueReusableCellWithIdentifier:@"AddressCell" forIndexPath:indexPath];
                cell.textLabel.text = self.shipmentEntity.address;
                cell.detailTextLabel.text = [NSString stringWithFormat:@"%@, %@ %@",
                                             self.shipmentEntity.city,
                                             self.shipmentEntity.region,
                                             self.shipmentEntity.postalCode];
                break;
            case 2:
                cell = [tableView dequeueReusableCellWithIdentifier:@"PhoneCell" forIndexPath:indexPath];
                cell.detailTextLabel.text = self.shipmentEntity.phone;
                break;
            case 3:
                cell = [tableView dequeueReusableCellWithIdentifier:@"TextCell" forIndexPath:indexPath];
                cell.detailTextLabel.text = self.shipmentEntity.text;
                break;
            case 4:
            {
                cell = [tableView dequeueReusableCellWithIdentifier:@"DeliveryStatusCell" forIndexPath:indexPath];
                NSString *typeLabel =
                [[self.shipmentEntity deliveryStatus] valueForKey:@"statusDescription"];
                cell.detailTextLabel.text = typeLabel;
                break;
            }
            case 5:
                cell = [tableView dequeueReusableCellWithIdentifier:@"ShipmentIDCell" forIndexPath:indexPath];
                cell.detailTextLabel.text = self.shipmentEntity.shipmentID;
                break;
               
            default:
                break;
        }
   
    }
    else if (indexPath.section == 1)
    {
        ShipmentItemEntity *shipItem = [shipmentItemList objectAtIndex:indexPath.row];
        cell = [tableView dequeueReusableCellWithIdentifier:@"ShipmentItemCell" forIndexPath:indexPath];
       
        cell.textLabel.text = [NSString stringWithFormat:@"(%u) %@",
                               shipItem.quantity,
                               shipItem.itemDescription];
        //Change the image of an Apple TV (badboy)
        if ([shipItem.itemDescription rangeOfString:@"Badboy"].location != NSNotFound) {
            cell.imageView.image = [UIImage imageNamed:@"AppleTVCellImage.png"];
        }
    }
   
    return cell;
}

Pages: [1]