Showing posts with label Swift. Show all posts
Showing posts with label Swift. Show all posts

Thursday, July 2, 2015

[EMiner] Your Envato Sales and Earnings Insights with Notifications for iOS


Yes this is my new app! (can download here if you're seller at Envato) with took 8 months to get it done! whoops! This happen slower than I expected previously Objective-C app which took me around 6 months to learn and release. Let's see my dev log all in one page!

Here's what I learn and use to develop

  1. Swift 1.0, 1.2, 2.0
  2. Swift Protocols
  3. Xcode Auto Layout
  4. Alamofire 
  5. ReactKit
  6. SwiftTask
  7. Parse iOS
  8. Bolts-iOS

And for Backend

  1. Parse Cloud Code
  2. Parse Javascript
  3. Parse Push
  4. Moment.js
  5. Underscore.js

And for Design

  1. Material design
  2. Google Material Color in Swift
  3. Flat shaded design for logo

Finally landing page at http://debokeh.com/

And here's fun part (kidding)


#1 Archive Error

Everything go as a plan, Even I design all this by myself like usual. I've to revise nearly 5 versions! I'm my worst customer! After digging in Swift migration nightmare and fighting with (awkward) Envato API then the day to release is come....and when I try to Archive... TADAAA
Hmm....

ERROR ITMS-90362: "Invalid Info.plist value. The value for the key 'MinimumOSVersion' in bundle EnvatoMiner.app/Frameworks/Alamofire.framework is invalid. The minimum value is 8.0"

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'EnvatoMiner.app/Frameworks/Alamofire.framework/Alamofire' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

ERROR ITMS-90206: "Invalid Bundle. The bundle at 'EnvatoMiner.app/Frameworks/ReactKit.framework' contains disallowed file 'Frameworks'."

The resulting API analysis file is too large.  We were unable to validate your API usage prior to delivery.  This is just an informational message.

WARNING ITMS-90080: "The executable 'Payload/EnvatoMiner.app/Frameworks/Alamofire.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."


#2 Frameworks Error

For Alamofire and ReactKit mess up do try use pod to handle Frameworks instead.


#3 Optimization Error

And for
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."
Try use Optimization Level  to both None


#4 Upload Eror

And guess what I failed to upload binary via Xcode 6.3 just like other , and yes export ipa did the trick


#5 Metadata Rejected

Now binary is up! But guess what!? Final boss is here! TADAAAA

Metadata Rejected
June 30, 2015
Information Needed We began the review of your app but aren't able to continue because we need additional information about your app. At


We began the review of your app but aren't able to continue because we need additional information about your app.

At your earliest opportunity, please review the following question(s) and provide as much detailed information as you can. The more information you can provide upfront, the sooner we can complete your review.

(1) Who is the intended audience of the app?
(2) What is the purpose of the app?
(3) Why does the app require an API key?
(4) Are there any costs associated with the API key?
(5) Are these tied to specific user accounts?
(6) How does the content of the app change with different API keys?

Once you reply to this message in Resolution Center with the requested information, we can proceed with your review.
Yes apparently Apple's reviewer didn't know anything about Envato API so they keep asking me mostly about user privacy concerning which pretty obvious (to me) in my case because Envato site have all this information provided but yeah just play along the rules. Don't forget to answer them nicely.


And here's new trick to save you a day or two

This clarify will took 1-2 days to ping-pong with reviewer so next time don't forget to add this information (1)-(6) right away while you submit via more information field!

PS: Want to know what I answer to the reviewer to get approval at 1st try? Wait until my app reach 100 downloads and I will reveal the hint! (Yeah, not again LOL)

As you can see it's a plenty things to learn and many problems to hit along the way, Just deal with it and happy coding!

Friday, June 5, 2015

[Swift] ActionHero Client with Swift

Tadaa
Tadaaaaa 

Here's Swift version


client = AHClient()

client.on("alert") { message in println(message)}
client.on("api") { message in println(message)}

client.on("welcome") { message in self.appendMessage(message)}
client.on("say") { message in self.appendMessage(message)}

client.connect() {
    self.client.roomAdd("defaultRoom");
}

Compare to JS version

client = new ActionheroClient;

client.on('alert',        function(message){ alert( JSON.stringify(message) ) })
client.on('api',          function(message){ alert( JSON.stringify(message) ) })

client.on('welcome',      function(message){ appendMessage(message); })
client.on('say',          function(message){ appendMessage(message); })
client.connect(function(err, details){
    if(err != null){
        console.log(err);
    }else{
        client.roomAdd("defaultRoom");
        document.getElementById("name").innerHTML = "\"color:#" + intToARGB(hashCode(client.id)) + "\">" + client.id + "" 
    }
});

Nice eh? :D

BTW : It's just proof of concept, no error/test, so heavy fork is need!
FYI : I'm moving on to MQTT , so don't expect any update so soon.
TL;DR : https://github.com/katopz/actionhero-client-swift

Happy Coding!

Thursday, May 28, 2015

[Swift] Hello World Primus with Swift via ActionHeroJS

Pretty much same as Objective-C implement nothing to special, just this fancy block...
class Block<T>  {
    let f : T
    init (_ f: T){ self.f = f }
    var casted: AnyObject { get { return unsafeBitCast(f, AnyObject.self) } }
}
Which I can't find shorter way yet


Happy Coding!



Thursday, January 8, 2015

[Cucumber] Hello Calabash Swift iOS

Behavior-driven development (BDD) Why?

  • why not?
  • it's fun
  • why not!?

Required

  1. http://brew.sh/
  2. $ brew install ruby
  3. $ gem install calabash-cucumber --no-ri --no-rdoc
  4. $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
  5. $ sudo gem install bundler

Install


  1. $ git clone https://github.com/codingricky/todoSwift
  2. In Xcode : open SingleTodo.xcodeproj and set Build Active Architecture Only = No

  3. fix error as Xcode suggest, build and run once to make sure it work properly
  4. $ cd todoSwift
  5. $ calabash-ios setup
  6. if you get
    ._SingleTodo.xcodeproj
    We don't yet support this. Please setup calabash manually.
    do try delete it by...

    $ rm ._SingleTodo.xcodeproj

  7. In Xcode : switch to SingleTodo-cal scheme
  8. $ calabash-ios gen
  9. $ cucumber

Trouble?

  1. cry
  2. make sure all update https://github.com/calabash/calabash-ios/wiki/B1-Updating-your-Calabash-iOS-version#updating-calabash-ios and close then reopen terminal  
  3. try https://github.com/calabash/calabash-ios/wiki/Hot-Topics#1-when-targeting-a-simulator-the-app-launches-then-quits-several-times-in-rapid-succession
  4. Time out waiting for UIAutomation run-loop? try this

    $ DEVICE_TARGET="iPhone 6 (8.1 Simulator)" cucumber

  5. Unable to unzip calabash.framework.zip? try here for temporary workaround https://github.com/calabash/calabash-ios/issues/682

    ----------Info----------
    error:  cannot delete old ./calabash.framework/Headers
    error:  cannot delete old ./calabash.framework/Resources
    error:  cannot delete old ./calabash.framework/Versions/0.12.0
    error:  cannot delete old ./calabash.framework/Versions/Current
    caution: excluded filename not matched:  __MACOSX/*
    caution: excluded filename not matched:  calabash.framework/.DS_Store
    
    ----------Error----------
    Unable to unzip file: /usr/local/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.12.1/bin/../staticlib/calabash.framework.zip
    You must install manually.
    ---------------------------
  6. yelling for permission? gimme sudo!
  7. $ sudo chown -R replace_this_with_your_name /usr/local/lib/ruby/gems/2.2.0

Cached?

  1. $ calabash-ios sim reset

Next?

  1. Feature: Todo list application can add tasks
      As a user
      I want to add tasks
      So I can remember to do things
    Scenario: Add Task
      Given I am on the Welcome Screen
      When I touch "Add"
      Then I enter "listening to Taylor Swift" into input field number 1
      And I touch "Add task"
      Then I wait for "listening to Taylor Swift" to appear

Reference

Note to self

Happy Testing! :D