2015年7月21日 星期二

如何抓到目前的thread標籤

//Objective-C
NSLog(@"%s", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL));

//swift
println(String(UTF8String: dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL))!)

2015年7月20日 星期一

navigationController連續push的crash問題

//實作UINavigationControllerDelegate
func navigationController(navigationController: UINavigationController,
        didShowViewController viewController: UIViewController,
        animated: Bool)
    {
        //TODO:擋住新的push或是在這裡放closure來push新的viewController
    }

2015年7月16日 星期四

Custom Preprocess Flag 設置自定義的預處理的方式

OTHER_CFLAGS (Other C Flags)
// 在Target>Build Setting>Custom Compiler Flags>Other C Flags
// 或Target>Build Setting>Swift Compiler>Custom Flags>Other Swift Flags
// 前面要加-D。舉例來說-DRELEASE -DDEVELOPMENT

GCC_PREPROCESSOR_DEFINITIONS (Preprocessor Macros)
// 在Target>Build Setting> Preprocessing > Preprocessor Macros

INFOPLIST_PREPROCESSOR_DEFINITIONS (Info.plist Preprocessor Definitions)
// 在Target>Build Setting> Packaging > Info.plist Preprocessor Definitions

2015年7月9日 星期四

Xcode的Debug小技巧

加入之後,可以看到解釋清楚的crash原因。

ASTableView的update方式

self._tableView.beginUpdates()
                self._tableView.deleteSections(indexSet, withRowAnimation: UITableViewRowAnimation.Fade)
                self._tableView.reloadSections(indexSet, withRowAnimation: UITableViewRowAnimation.None)
                self._tableView.endUpdates()

a social app needs to have precautions mechanism.

14.3 Details Your app enables the display of user-generated content but does not have the required precautions in place. Next Steps It
July 9, 2015 at 8:43 AM
From Apple
14.3 - Apps that display user generated content must include a method for filtering objectionable material, a mechanism for users to flag offensive content, and the ability to block abusive users from the service
14.3 Details

Your app enables the display of user-generated content but does not have the required precautions in place.

Next Steps

It is necessary that you put all of the following precautions in place:

- Require that users agree to terms (EULA) and these terms must make it clear that there is no tolerance for objectionable content
- Use moderators to flag and remove inappropriate content and offensive users
- Users need a mechanism to flag objectionable content and report users generating this content
- Developer must act on objectionable content reports within 24 hours by removing the content and ejecting the user who provided the offending content
- Developer needs a method for ejecting users who violate the terms of the EULA

Reply Use the field below to ask questions or provide additional information to the App Review team. Learn More Submit an appeal to the App Review Board.This field is required. 4000
Attach File
Send

Therefore, we have three task need to be finished:1. Term agree, 2. block user, 3. report abuse content

2015年7月6日 星期一

在yourUIView.swift中與xib做聯結

required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.view = NSBundle.mainBundle().loadNibNamed("ChatPanelView", owner: self, options: nil)[0] as! UIView
        self.view.frame = CGRectMake(0, 0, DefaultConfig.SCREEN_WIDTH, 87)
        self.addSubview(self.view)
        self.setNeedsUpdateConstraints()
        self.inputTextField.text = Language.get("TYPE_A_MESSAGE", comment: "Type a message")
        self.inputTextField.scrollEnabled = false

    }