I am trying to get a notification to appear when the app is in the background or suspented, as the LocalNotification does not work, I seen mention the CFUserNotification as a potential solution, but when i include the corefoundation framework to my app the CFUserNotification is still no-where to be found, can someone show me how to include CFUserNotification in my project ?
Can you use CFUserNotification with IOS 5.1?
No
If you're not making this for the App Store, you can use private APIs. The way I have used CFUserNotifications is to
Add CoreFoundation.framework to the list of frameworks I link against (maybe this framework is automatically included ... I'm not sure ... I just know that it doesn't hurt to add it explicitly to your project).
The CoreFoundation public APIs still don't have the CFUserNotification functions in the headers, as Justin said. So, you need to manually include a complete CFUserNotification.h header. You can find a copy here. Just copy that whole header file, and include it in your project source directory. Then #import "CFUserNotification.h" where you want to use it.
Then, the compiler will let you access those CFUserNotification APIs. I've done this on iOS 5.0 with success (on a device).
Related
There once existed and may still exist a part of the private iOS API, in CoreTelephony, called CTMessageCenter, which was a class that could be used to programmatically send SMS.
I've struggled for a while now trying to figure out if it is possible to use this class on iOS 9, even going so far as to download these iOS runtime headers and attempt to include the framework in my project... it appears as empty after the import. In any case, CTMessageCenter seems to have vanished... surely it still exists or has an alternative.
I've tried using selectors, just importing CTMessageCenter.h, and probably other things I can't remember... any help with this would be appreciated.
I want to use AsynchronousImageView and AsynchronousNetworking classes in Keyboard Extension. Can you Please tell How to use this classes in code. I has implemented AsynchronousImageView code its compile perfect but during run time it will crash..
my code is:
self.imageVw.ImageUrl=[NSURL URLWithString:#"http://www.gamacompass.com/imagesuploaded/000001631/_thumbnails/sku_3451_000001631_large.jpg"];
As i found in apple documentation we need one flag to use that library in extension.
Use any API marked in header files with the NS_EXTENSION_UNAVAILABLE macro, or similar unavailability macro, or any API in an unavailable framework
I've created a simple lib to use HMAC digest for Swift called "SweetHMAC". This lib is so simple, basically is a wrapper to CommonHMAC.h in Swift.
I can build and deploy any iOS project using SweetHMAC correctly but, seems by some security issue, my approach is not safe. There is the warning I receive after run the iOS tests for example.
warning: linking against dylib not safe for use in application extensions
This code is not safe enough to put in iOS AppStore, and the app can be rejected by that. For OSX, there is no problems.
I know, there are HMAC ports for Swift, but my challenge is to try to enable Swift to use CommonCrypto safely.
I have implemented this project using this approach and works fine!
My question is, how possible is to create and use use modules like CommonCrypto in Swift frameworks safely for iOS?
Looking at the documentation from Apple, the suggestion for said error is to make sure that the option of using "Require Only App-Extension-Safe API" is checked.
To configure an app extension target to use an embedded framework, set the target’s “Require Only App-Extension-Safe API” build setting to Yes. If you don’t, Xcode reminds you to do so by displaying the warning “linking against dylib not safe for use in application extensions”.
Here's the full documentation on extensions
It is also worth noting that parts of the CommonCrypto API might not be available, as per this discussion
I'm using the Facebook-SDK to make some FQL queries. Now I want to know how much of the requested data has already been transferred to the app to visualize the loading process in a progressbar.
So I used this https://github.com/nyankichi820/FBRequestConnection-FBRequestConnection_progress plugin which extends the FBURLConnection class to provide the progress of a data transfer.
The problem is, that I included the Facebook-SDK as an XCode framework into the project and the header file FBURLConnection.h which is necessary for the plugin is not published in the framework and cannot be found.
So how can I include the header file FBURLConnection.h into the frameworks visible headers so that I can access it? I dont't want to include all the FB-SDK files, I wanted to do this by relying on the XCode framework structure. Thanks in advance.
You should probably include the source of the framework yourself manually or much more simply using cocoapods.
Here is the github link to the SDK source: https://github.com/facebook/facebook-ios-sdk
The official cocoapod is named "Facebook-iOS-SDK", if you decide to go that route. I recommend doing this as it is much simpler to install the SDK and update it later on. Cocoapods are very nice for external components in general and will almost certainly save you time and frustration in the long run.
I don't want to submit this app to AppStore. I've tried for many times but met so many problems :(
I use class-dump to get all the header files of UIKit.framework. In the UIApplication.h generated by class-dump, I saw the method I want to use----launchApplicationWithIdentifier.
Then I put UIApplication.h in my project and import it. Compile, I got a lot of "Redefinition of enumerator...." error because in the UIKit.framework I use previous, there's another UIApplication.h. But this file doesn't have the method launchApplicationWithIdentifier.
If I delete the previous UIKit.framework and import the folder generated by class-dump. Then it appears like a framework but if I unfold it, it's empty.
Then I want to make all generated header files a framework file ant replace the previous UIKit.framework. But I don't know how. As we can see, under the system framework directory, there's a file which has the same name as the framework and has a 'executed shell script' icon. How can I made this file?
I really got confused. Someone can give me a hand? Thank you.
Just specify the private methods in a category interface above the class implementation where you want to use it, like this:
#interface UIApplication (Private)
- (BOOL)launchApplicationWithIdentifier:(id)identifier suspended:(BOOL)suspended;
#end
Don't import the whole class-dump file and link with the original UIKit framework.
You must be very careful when using private API. These methods can change or be removed in future iOS versions!
Check if the method really exists with respondsToSelector: at runtime and be prepared for the case that it does not exist.
I used a secret MapKit feature in my own application and I knew that the private methods only exist in iOS 5. So my app still works in all iOS versions but this feature is only available in iOS 5 (Apple removed or changed it in iOS 6 beta 1).