
iOS
智慧光
这个作者很懒,什么都没留下…
展开
-
deviceToken value always is "32bytes"
在func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) 获取到deviceToken,值未nil,deviceToken发现值为”32bytes”解决方法:let deviceTokenString = deviceToken原创 2017-01-03 11:02:45 · 1018 阅读 · 0 评论 -
how to get UDID
Open the site udid.io in Safari on your iPhone or iPad原创 2016-10-08 01:29:00 · 467 阅读 · 0 评论 -
download image with Alamofire
Alamofire.request(.GET, profile_picture_url!).response { (request, response, data , error) in if error != nil { NSLog("Error downloading thumbnail ima原创 2016-10-07 10:07:33 · 735 阅读 · 0 评论 -
Swift 3 and Swift 2.3 change
One case:when swift 3 to swift 2.3, just remove “_” before parameter, correspondingly when swift 2.3 to swift 3, just add “_” before parameter, Example: Swift3: typealias LMLocationCompletionHandle原创 2016-10-06 22:22:00 · 823 阅读 · 0 评论 -
how to pase JSON in Swift
http://roadfiresoftware.com/2015/10/how-to-parse-json-with-swift-2/Example: { “blogs”: [ { “needspassword”: true, “id”: 73, “url”: “http://remote.b原创 2016-10-19 03:55:56 · 507 阅读 · 0 评论 -
FCM issues (Firebase Cloud Message)
Check this video, youtube.com/watch?v=VpbNFIY1qJ0 time 13:45. They said that if you set Info.plist FirebaseAppDelegateProxyEnabled to NO you should call “setAPNSToken” and “appDidReceiveMessage (http:原创 2016-10-19 03:45:20 · 1440 阅读 · 0 评论 -
iOS issues
1: for devices running iOS 10 and above, you must assign your delegate object to the UNUserNotificationCenter object to receive display notifications, and the FIRMessaging object to receive data messag原创 2016-10-19 03:08:21 · 631 阅读 · 0 评论 -
Unable to connect with FCM. Optional(Error Domain=com.google.fcm Code=501
Solution: open push notification and in backgroud mode open remote notification in Xcode 8iOS 9.3// [START connect_to_fcm] func connectToFcm() { //FIRMessaging.messaging().connect { (erro原创 2016-10-19 02:38:31 · 1438 阅读 · 0 评论 -
NSObject in swift2 can present AnyHashable in swift3
AnyHashable is new structure in Swift 3原创 2016-10-19 02:16:47 · 755 阅读 · 0 评论 -
should set iOS platform when using alamofire
when using alamofire with Cocoapod, should set iOS platform in Podfile otherwise alamofire library can not be find when import AlamofireExample: platform :ios, ‘9.0’use_frameworks!target ‘Your Projec原创 2016-10-04 22:18:23 · 389 阅读 · 0 评论 -
how to set custom navigator title
Method is that navigationItem.titleView uses UIView, and this UIView add custom title. example: var containerView = UIView() containerView.frame = CGRectMake(30, 30, 400, 50) var titlevi原创 2016-10-28 02:10:09 · 290 阅读 · 0 评论 -
How do I access a nested JSON(嵌套JSON) value using Alamofire and SwiftyJSON
http://stackoverflow.com/questions/35287836/how-do-i-access-a-nested-json-value-using-alamofire-and-swiftyjsonfunc getAPI() { Alamofire.request(.GET, “http://quotes.rest/qod.json“, parameters: [“conte原创 2016-10-04 00:05:40 · 510 阅读 · 0 评论 -
iOS10 need permission when using Camera and others
After ios 10 you have to define all the system feature access in inof.plist as below:Calendar : Key : Privacy - Calendars Usage Description Value : $(PRODUCT_NAME) calendar eventsReminder :转载 2016-10-03 23:48:57 · 525 阅读 · 0 评论 -
Permissions Reference - Facebook Login
https://developers.facebook.com/docs/facebook-login/permissions#reference-public_profile原创 2016-10-03 08:29:05 · 1016 阅读 · 0 评论 -
how to dismiss UIAlertController once clicking outside itself?
func tapColor(sender: UIGestureRecognizer) { let paraList = [ "Grey","Black","Brown" ] func actionSheetHandlerParameters(para : String) { ColorLabel.text = para Colo原创 2016-10-27 02:20:52 · 571 阅读 · 0 评论 -
How to use Facebook iOS SDK on iOS 10
http://stackoverflow.com/questions/38689631/how-to-use-facebook-ios-sdk-on-ios-10/38799196It happens because Apple changed the way of working with keychain in iOS 10. To fix this issue you simply shoul转载 2016-10-02 10:57:26 · 536 阅读 · 0 评论 -
combine facebook and google/Twitter together
according to facebook and google developer reference, if you add them together, you will find that once authorize the facebook, it will not return.Solution is: func application(application: UIApplicat原创 2016-10-02 09:32:24 · 331 阅读 · 0 评论 -
how to fix some resource like video not show on iphone 6 but show on simulator
if after the following ways, it still not shown on iphone 6 1: delete reference and then add again 2: change name Then the reason maybe is video problem, NOT code problem. Change another video whic原创 2016-10-01 00:40:14 · 310 阅读 · 0 评论 -
Instance member cannot be used on type
reason: The error is because the type tries to access the self property before self was initialized (initialization happens after defining the values for properties). Solution: define first before in原创 2016-10-08 11:19:27 · 7653 阅读 · 0 评论 -
self.navigationItem.titleView不居中
为什么self.navigationItem.titleView有时候不能居中呢答一:UINavigationBar automatically centers its titleView as long as there is enough room. If the title isn’t centered that means that the title view is too wide to转载 2016-10-21 06:12:58 · 687 阅读 · 0 评论 -
how to remove 1px line at UINavigationBar
let navBar:UINavigationBar=UINavigationBar()navBar.frame=CGRectMake(0, 0, view.frame.width, 80)navBar.shadowImage = UIColor.whiteColor().as1ptImage()navBar.setBackgroundImage(UIColor.whiteColor().as原创 2016-11-01 05:41:20 · 584 阅读 · 0 评论 -
xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is
method: select Xcode version in Command Line Tools in Location(Click Xcode and then Preferences)Before: After:原创 2016-12-20 06:57:52 · 4499 阅读 · 0 评论 -
Property with 'retain (or strong)' attribute must be of object type
RongIMKit.framework/Headers/RCMessageModel.h:94:30: Unknown type name ‘RCReadReceiptInfo’ (2)RongIMKit.framework/Headers/RCMessageModel.h:94:1: Property with ‘retain (or strong)’ attribute must be of o原创 2016-12-29 23:47:00 · 1238 阅读 · 0 评论 -
duplicate symbols for architecture x86_64 and No such file or directory
two errors: 1: duplicate symbols for architecture x86_64 2:error: cannot parse the debug map for “/Users/— Library/Developer/Xcode/DerivedData/ProjectName- dejxrzrmfgomxxcrzloplmsozads/Build/Pro原创 2016-12-29 12:11:10 · 652 阅读 · 0 评论 -
how to change Scheme name
Choose “Edit Scheme” from the “Product” menu. Click on the “Manage Schemes…” button Select the scheme whose name you wish to change Press the “Return” key It will select the name of the scheme and转载 2016-12-20 05:51:19 · 519 阅读 · 0 评论 -
Ambiguous reference to member 'dataTask(with:completionHandler:)'
Ambiguous reference to member ‘dataTask(with:completionHandler:)’let request = NSMutableURLRequest(url: URL(string: “Your API URL here” ,param: param))!, cachePolicy: .useProtocolCachePolicy,原创 2016-12-29 09:45:24 · 1944 阅读 · 0 评论 -
Expression was too complex to be solved in reasonable time; consider breaking up the expression into
Xcode 7 works fine if calculate the value of -60*60*24*2-60*60 but there is an error on Xcode 8 which says Expression was too complex to be solved in reasonable time; consider breaking up the expressi原创 2016-12-29 09:12:42 · 1680 阅读 · 0 评论 -
swift 3, swift2
Swift3:DispatchQueue.main.async(execute: { })Swift2: dispatch_async(dispatch_get_main_queue(), { })TimeInterval–swift3 NSTimeInterval–swift2fileprivate-swift3 private-swift2D原创 2016-12-21 12:18:58 · 1158 阅读 · 0 评论 -
Convert to Current Swift Syntax Failed: Could not find test host
Method: Select the Xcode project in the lefthand browser. Click on your test target in the Project’s General tab. Disclose “YorrPorojectNameTesting”. In my project the “Host Application” pulldown bu转载 2016-12-21 11:35:13 · 1473 阅读 · 0 评论 -
Why is NSNotification its observer called multiple times
a likely cause is that your viewcontrollers are over-retained and not released when you think they are. This is quite common even with ARC if things are over-retained. So, you think that you have only转载 2016-11-26 07:49:10 · 581 阅读 · 0 评论 -
how to quit webview player
UIMoviePlayerControllerDidExitFullscreenNotification NSNotification not working in iOS 8UIWebView上播放视频,获取全屏播放事件/退出全屏播放 之前的办法: [[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(转载 2016-11-26 04:39:58 · 557 阅读 · 0 评论 -
can not find difinition of a class
the library already add in Xocde, you need import the library in the sourecode. but if by setting Xocde , you may not need to import the library原创 2016-12-06 01:31:52 · 441 阅读 · 0 评论 -
AFNetworking required by Podfile AFNetworking (= 2.6.0) required by Podfile.lock
AFNetworking required by Podfile AFNetworking (= 2.6.0) required by Podfile.locksolution: remove or rename Podfile.lock and run pod install again if AFNetworking (= 2.6.0) required by other library,原创 2016-12-05 23:53:13 · 1188 阅读 · 0 评论 -
image not found
the app canrun with Xcode. but if just click the app in simulator, it can not run and no error clue. If run in real device, xcode will give the following message: dyld: Library not loaded: @rpath/Vime原创 2016-12-05 12:09:39 · 912 阅读 · 0 评论 -
iBeacon develop
Beacon Vendor Default UUID Open Beacon AA6062F0-98CA-4211-8EC4-193EB73CEBE6 Estimote B9407F30-F5F8-466E-AFF9-25556B57FE6D Radius Networks 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 Beacon Inside F原创 2016-12-12 02:24:37 · 751 阅读 · 0 评论 -
can not remove app on iphone simulator?
method to fix it: Click the simulator to active it, then select hardware in simulator tools followed by clicking “Touch pressure”. In the “Touch pressure” option, click “Shallow press” to make it not原创 2016-11-18 23:11:10 · 378 阅读 · 0 评论 -
method to solve the problem : Could not cast value of type 'NSManagedObject_ to
Set module!!!原创 2016-11-30 12:41:17 · 681 阅读 · 0 评论 -
tableview cells after several cells can not selected
Description: first top several table cells can be selected, but after tableview cells after several cells can not selectedReason: table view height is too smallSolution: set table view height bigge原创 2016-11-30 00:25:49 · 395 阅读 · 0 评论 -
no valid 'aps-environment' entitlement string found for application xcode 8
Solution: Need open Push notification at Capabilities tab in XcodeOnce open push notification, You will see steps : Add push notifications entitlement to your entitlement file原创 2016-10-16 06:35:12 · 1129 阅读 · 0 评论 -
method to solve 404 error when using NSURL to add suffix
func URLWithPath(path: String) -> NSURL { //return NSURL(string: path, relativeToURL: baseURL)! //will cause 404 error when visit url in Xcode8//Use this way var newUrl : NSURL原创 2016-09-29 23:54:50 · 249 阅读 · 0 评论