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.

Messages - runartrollet

Pages: [1]
Book 3: Mastering Xcode and Swift / Re: XCode 6
« on: September 29, 2014, 12:49:40 PM »
October 1st would be an awesome timing. After a fairly successful game made after going through your books, we just got a new idea for another math-game, this time more educational. We absolutely love the live code preview, and this will make development go so much faster. We did think to just figure out everything about Swift for ourselves, but when you book is coming in just a matter of days, we will of course wait. In the meantime, we are doing some more planning, which is good for any project anyway.

"How To" Topics / Re: Need help fast with user keyboard
« on: August 23, 2014, 11:08:06 AM »
It was resolved by somebody on StackOverflow. Great!

"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:

General Discussions / Re: What app(s) did you build already?
« on: August 02, 2014, 06:40:00 PM »
Just thought I'd mention that my game is coming along nicely and achieving a good fair amount of downloads. Feel free to take a look at our video if anybody is interested.

General Discussions / Re: What app(s) did you build already?
« on: June 26, 2014, 01:03:27 PM »
yeah, well, promoting the app seems difficult.  It has just been two days, but I feel a bit disappointed on the downloads fronts, really. But I guess have to give it more time, and promote it more.

General Discussions / Re: What app(s) did you build already?
« on: June 26, 2014, 08:43:32 AM »
I have just finished my second game. The 3 books have been really helpful. Other than that I have been using mostly stackoverflow, and google, just to get answers to specific things that I have either misunderstood or are not covered in the books. Don't get me wrong, the books really covers a lot of what I need, especially to get started. I find them a lot easier to follow than some other books I have tried, but didn't find much useful.

My game is now in the App Store, and it turned out a lot better than I expected. I hope it is okey that I post this here, but if anybody here wants to take a look at it, you are welcome. PM me and I'll give you a promo code. We also made a trailer, which is at my website.

Book 3: Mastering Xcode and Swift / Re: Managing change in datamodel
« on: June 11, 2014, 07:06:20 AM »
ok, thanks, this doesn't seem to crash, but now, i have a different problem. When I try to regenerate the NSManagedObject subclass from the database2, it doesn't list any of the entities. They are only listed in the first database.

What I did:
Create a new version of the data model, called database 2.
Add two attributes to database 2.
Set database 2 as current

Delete SettingsEntity.h and .m
Try to rebuild it.

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.'

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

(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];

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:

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 ?


"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?


"How To" Topics / Re: Container Views
« on: April 08, 2014, 01:42:43 AM »
Ok, great. Got it working somewhat here. I am however stumped here, with performing segues on the container view. I do manage to do it from the MainView. I added a public method for it like this:

Code: [Select]
- (void)changeView:(NSString *)where
    NSLog(@"Going to %@", where);
    NSLog(@"Going from %@",self.childViewControllers);
    UINavigationController *a = self.childViewControllers[0];
    UINavigationController *b = a.childViewControllers[0];
    [b performSegueWithIdentifier:where sender:self];

This code is in the MainView.m -file. I called this from a button which is in the MainView, and it works. However, I tried calling it from inside one of the childViewControllers, but it did not work. The app crashes. NSLOg shows that self.childViewControllers is just (), so it has no childViewControllers. I tried to NSLog 'self', and it logs "MainView", which does have the childViewControllers. I don't understand why I can't list the childViewControllers from there.

Could you help me out?

"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.

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";
            case 1:
                return @"Shipment Detail";
                return nil;
    - (NSString *)tableView:(UITableView *)
tableView titleForFooterInSection:
(NSInteger)section {
        switch (section) {
            case 0:
                return @"Be kind and courteous!";
                return nil;
    UITableViewCell *cell;

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

Book 3: Mastering Xcode and Swift / Re: chapter12- sqlite
« on: March 30, 2014, 08:54:01 AM »
Hi, I am getting the same error as discussed in this topic. First I looked at possible typos, but i don't that is the case here. I have checked and double-checked for typos here. Really can't find any. Are there any other references to the iDeliverMobileCD -database except for the filename? Originally, I had misspelled the name for it, so I renamed it to iDeliverMobileCD, and hoped that was the only reference to it. Could you have a look at it?



Just figured out what was causing the issue. Renaming the xcdatamodel -doesnt rename the full path. I did first name it wrong, iDeliverMobileCd, with a small d in the end. This was changed to a big d, in the file inspector. After looking at the full path, i discovered that Xcode does not update the full path correctly. here is the full path, after the rename:

Code: [Select]
/Users/iMac/Documents/Xcode/3 Navigating xcode/iDeliverMobileCD 2/iDeliverMobileCD/iDeliverMobileCd.xcdatamodeld/iDeliverMobileCD.xcdatamodel
as you can see it referenced the file with both the old name and the new one, changing only the filename, but not its folder name. i thought I should just post this here, so if others have the same problem. I've attached a photo.

Pages: [1]