http://stackoverflow.com/questions/16427421/how-to-remove-cocoapods-from-a-project
Thursday, October 1, 2015
Tuesday, September 1, 2015
Xcode 7 (beta): Networking issue solved
add this to Info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
specific exception can also be added:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>testdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<false/>
<key>NSExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionAllowInsecureHTTPSLoads</key>
<false/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSRequiresCertificateTransparency</key>
<false/>
</dict>
...
</dict>
</dict>
Facebook Video Upload on iOS using latest Facebook SDK for iOS(4.x)
let videoData = NSData(contentsOfURL: NSURL.fileURLWithPath(path))
if (hasGrantedPermission("publish_actions")) {
var params = [String: AnyObject]()
params["fields"] = ""
params["video.mov"] = videoData
params["contentType"] = "video/quicktime"
params["description"] = "Test"
FBSDKGraphRequest(graphPath: "/me/videos", parameters: params, HTTPMethod:"POST").startWithCompletionHandler {
(connection, result, error) -> Void in
}
}
Wednesday, July 1, 2015
Detect idle time and do something when timer fires (Swift)
func resetIdleTimer()
{
if (idleTimer == nil)
{
idleTimer = NSTimer.scheduledTimerWithTimeInterval(kMaxIdleTimeSeconds, target: self, selector: "idleTimerExceeded:", userInfo: nil, repeats: false)
}
else
{
if (fabs(idleTimer.fireDate.timeIntervalSinceNow) < kMaxIdleTimeSeconds-1.0)
{
idleTimer.fireDate = NSDate(timeIntervalSinceNow: kMaxIdleTimeSeconds)
}
}
}
func idleTimerExceeded(sender: AnyObject)
{
idleTimer = nil
//do something when timer fires
}
Thursday, June 25, 2015
hide/show with animation in Swift
For hiding the dock like view and show again
func hide(sender: AnyObject)
{
let frame = hideshowView?.frame
let height = frame?.size.height
let offsetY = height!
//hide after 10 seconds delay
if frame != nil {
UIView.animateWithDuration(0.5, delay: 10.0, options: UIViewAnimationOptions.CurveEaseIn, animations: { [weak self] () -> Void in
if let weakSelf = self
{
weakSelf.segmentedControl?.frame = CGRectOffset(frame!, 0, offsetY)
weakSelf.openBottomBarButton.hidden = false
}
}) { (Bool v) -> Void in
}
}
}
func show(sender: AnyObject)
{
let frame = hideshowView?.frame
let height = frame?.size.height
let offsetY = -height!
//show without delay
UIView.animateWithDuration(0.5)
{
hideshowView?.frame = CGRectOffset(frame!, 0, offsetY)
}
}
Subscribe to:
Posts (Atom)