I found NSSharedPublicDirectory is added in ios 4.0 and later.I tried to find detail about this but not able to get.Can explain about NSSharedPublicDirectory in ios 4.0 above?
NSSharedPublicDirectory is used to access a user's public directory, as per Apple documentation:
NSSharedPublicDirectory
Location of user's Public sharing directory (~/Public)
Available in iOS 4.0 and later.
Declared in NSPathUtilities.h.
But there is no additional explanation for it. When I execute this:
NSArray *Ar = NSSearchPathForDirectoriesInDomains(
NSSharedPublicDirectory, NSAllDomainsMask, YES);
I get this folder path:
/var/mobile/Applications/AppFolder/Public
I haven't found any important usage for this enum for iPhone, since there is no shared public directory in iPhone (AFAIK).
Also update me if you get to know more
Related
Example: App contains messages. User searches spotlight with string from message. Spotlight finds that app.
I have heard that spotlight can search app contents. But how to feed it to Spotlight on iOS?
According to the Core Data Spotlight Integration Programming Guide, the functionality you want is not available for iOS, only for Mac OS X.
This is now possible from iOS9 onwards.
Apple has released a CoreSpotlight SDK (WWDC2015) where, you can integrate your app to the spotlight of iOS and can do a content search.
There are other possible avenues to actually integrate different user activities to your app and can also search for things even when your app is not installed on the device.
If your app is an app that handles pdf for instance, if user searches for a pdf on his device, you app can come up in the spotlight preferences as an app he can use to read the pdf, even when your app is not installed on the user's device.
Considering your example, now its possible that if you search for a message string in spotlight, spotlight can open up your app and you can make the user actually navigate to find the exact message inside your app as well.
Adding link below :
You can find details for implementation.
https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-SW3
-Tejas
Here is an example of adding your app content to Spotlight via the new Search API's. This is available on iOS9 using XCode 7.
CSSearchableItemAttributeSet * attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage]; //Or whatever type
attributes.contentDescription = #"This is my content description.";
attributes.displayName = #"Display Name";
attributes.keywords = #["Stuff","Widget"];
attributes.subject = #"Subject";
attributes.title = #"Title";
CSSearchableItem *item = [[CSSearchableItem alloc] initWithUniqueIdentifier:someUniqueId domainIdentifier:#"SomeGroupName" attributeSet:attributes];
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:#[item] completionHandler:nil];
When the user selects the item in spotlight, the following method:
-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler
in your AppDelegate will be called. Check the userInfo dictionary in the userActivity object and send the user to the appropriate screen.
I have created a sample project to integrate corespotlgiht feature. It works on iOS 9 and requires Xcode 7 beta 2 to build. You can try out if it helps. https://github.com/majain/iPhoneCoreDataRecipes
Video link for the same is: https://youtu.be/Renm1xLDIFc
Non-public API usage:
Apps are not permitted to access the UDID and must not use the uniqueIdentifier method of UIDevice. Please update your apps and servers to associate users with the Vendor or Advertising identifiers introduced in iOS 6.
If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.
Kindly help me how to i avoid his problem.
Regards
John
Apps are not permitted to access the UDID and must not use the uniqueIdentifier method of UIDevice. Please update your apps and servers to associate users with the Vendor or Advertising identifiers introduced in iOS 6
Theres your answer.
"Starting May 1, the App Store will no longer accept new apps or app updates that access UDIDs. Please update your apps and servers to associate users with the Vendor or Advertising identifiers introduced in iOS 6"
Source
Apple now block any App which accesses the uniqueIdentifier property of UIDevice. Replace any occurrence with the Vendor or Advertising identifiers or use OpenUDID.
NSUUID *uuid = [[UIDevice currentDevice] identifierForVendor];
NSString *uuidString = [uuid UUIDString];
A few StackOverflow questions which may be of help:
Advertising Identifier for devices lower than iOS 6.0
iOS6 UDID - What advantages does identifierForVendor have over identifierForAdvertising?
The advertisingIdentifier and identifierForVendor return "00000000-0000-0000-0000-000000000000"
If you haven't used uniqueIdentifier yourself, then it will be an SDK Library calling it. Normally from an ad network such as Mobclix, AdMob or Smaato. All the popular ad networks have updated SDK's which remove uniqueIdentifier. Check their websites for the latest SDK.
Update
Just seen in the comments you're using PhoneGap, guessing you haven't updated to the latest version.
Apple have started rejecting UDID access now (PhoneGap)
Re: [PhoneGap] Uuids in ios 5 (PhoneGap)
Make sure your using the latest version (2.7.0) from http://phonegap.com/download/ (Released 30 Apr 2013)
I got the same issue and Apple gave me some tips to find out the Places that use "uniqueIdentifier" API call. Even in a binary lib.
"While you may have removed access and usage of UDIDs from your app,
the invalid binary message indicates that your app uses or accesses
UDIDs. Please check your source code for any occurrence of the
"uniqueIdentifier" method; this is the method that returns a device's
UDID.
Additionally, if you are linking an external framework, such as an
advertising library, these third party libraries may be accessing and
using UDIDs. We encourage you to update your libraries to the most
recent versions and use the "nm" tool to determine if the libraries
are calling this method.
For more information on the "nm" tool, please see the manual page for
the "nm" tool in Xcode Tools:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/nm.1.html
Additionally, if you do not have access to the libraries's source, you
may be able to search the compiled binary using "strings" or "otool"
command line tools. The "strings" tool can output a list of the
methods that the library calls and "otool -ov" will output the
Objective-C class structures and their defined methods. These
techniques can help you narrow down where the problematic code
resides."
Hope it helps
I am using this method to create a Unique Identifier.
Is this now not allowed. It was a month ago when release a previous version of my app.
- (NSString *)uuid
{
CFUUIDRef uuidRef = CFUUIDCreate(NULL);
CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
CFRelease(uuidRef);
return [(NSString *)uuidStringRef autorelease];
}
What else can I use to create a unique identifier.
Cheers
Shane
there's a way to access a real device (iphone/ipad) document folder? I realized an app that store some data in that folder and i wanted to check if all is going in the right way.
You can do this without iTunes and even if the file is somewhere else in the sandbox other than Documents.
Go to Window/Devices in Xcode.
Next, select your device, and find the app in the list.
Now, look at the little gear icon at the bottom of the devices window. Click that bad boy.
See "Download Container..." in the list. Guess what that does? You got it. It downloads the whole sandbox with all the folders in the app's sandbox. Right click and "Show Package Contents".
This should let you see the sandbox of apps that have not yet been released. So, good for testing on a real device.
If you're testing on a simulator life is way easier. Just download the free app OpenSim here . Update: These days I prefer SimSim, also free here.
To anyone looking out for the exact answer:-
1.Go to plist file of your project.
2.Add one row.
3.Then set the Boolean value of the property "Application supports iTunes file sharing" to "YES". (the key name is UIFileSharingEnabled)
And you are good to go.
Also note that you have to plugin the device in order to access the copied files (Programmatically). If you happen to go and try to access it on computer .. you wont be able to find the files.
Your question is a bit unclear, but I can see three interpretations:
You can plug your iPhone into iTunes to see your documents folder for any app with iTunesFileSharing enabled, including any apps you have written or are writing.
If this is your own app, and you need help reading files from the documents folder, take a look at this question.
If this is someone else's app, and you want to access the app's documents folder without iTunes and the app does not have implementation for what you want, then I am afraid some sort of jailbreaking and hacking is necessary.
iExplorer can help in figuring out for an iOS app. :)
Edit:
You are right, give a try to iMazing
Quick Solution
Just add this key in our plist and you're good to go
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
Visit this link for detailed explanation
You can access documents directory from code using:
+ (NSString *) applicationDocumentsDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
return basePath;
}
And you can then go to terminal for the same path and check all the files.
e.g on my system its like this:
~/Library/Developer/CoreSimulator/Devices/<deviceID>
If you are looking for a tool that import file from iOS app document folder to Mac, install Apple configurator 2 (https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12)
Connect your device to Mac and in Apple configurator follow below steps
Double click on the Device
Choose Actions > Export > Documents.
Select the file inside app to export, then click Choose. Save the items to the desired location in Mac.
If you have a physical device you can add the UIFileSharingEnabled
key in info.plist and set its value to YES
then run your app
open iTunes select device and goto file sharing and select your app
you will be shown files created by your app
I have a question that most of you might find a little odd. I am making an application for OS X, but I need it to write text files into an iPhone folder. I know the iPhone will have to be connected to the computer, and I do not think that emailing will work.
I thought it would be as simple as finding a path to the iPhone while it was connected (such as /iPhone/Documents), but I cannot figure out what the path is. If anybody can tell me how to find the path, or can give me a link to some useful information, I will be very greatful
EDIT: although it was not the answer I wanted, I got what I needed. I think all of these answers gave me an equal amount of information, so I had a hard time choosing which answer to accept. I accepted the one that provided me with an alternative way to get the files onto the iPhone. Thanks for all of the help, everyone!
You will only be able to transfer files to and from your application using iTunes.
In order to get this to work your app must register for sharing documents in the Info.plist file by setting the UIFileSharingEnabled key to YES. When this is done your app will when installed and the device in connected show up on the "Application" tab in iTunes at the bottom. Highlight the app in the list to the left, and drag and drop files to the list on the right.
This way any file stored in the applications documents folder will be visible to iTunes, and any file copied to the device in iTunes will show up in the documents folder. You find the documents folder in your app like this:
NSArray* paths = NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES);
NSString* path = [paths lastObject];
That's not going to be possible. The iPhone connects over a proprietary(-ish) connection to iTunes, so you don't have any access into the iPhone's filesystem in your custom app. Besides which, apps in the iPhone have separate document folders so there isn't a single "documents" location on the device.
If you're writing your own iPhone app and want to support sharing documents with the Mac, you can either implement a Bonjour-based syncing service, sync via DropBox or iDisk, or use iTunes File Sharing. The options and trade-offs are well documented in this technote.
The iPhone doesn't have a mass storage mode, as Apple wants iTunes to be the ONLY method of transferring files to/from the iPhone. Maybe iTunes has an API for this that you can exploit, but otherwise the only way to get access to the file system in there is on jailbroken devices or via apps
In the iPhone SDK I don't see the same SCDynamicStore used on Mac OS X to get the SSID name that your wireless network is currently connected to isn't available.
Is there a way to get the SSID name that the iPhone is currently connected to?
I see some apps do it (Easy Wi-Fi for AT&T for one) but I can't find how it's done in the iPhone SDK docs. A private or unpublish method would be acceptable just as a proof of concept (although I know that likely wouldn't make it to the AppStore).
This is now possible (iOS 4.1+) via the Captive Network API.
See an example of how to use it on this similar question.
This is not a private API.
After digging around I found the anser to this. There are unpublished APIs in the Preferences framework. For examples of this one can look at the Stumbler code hosted on Google Code.
I filed a radar with Apple (#6407431/OpenRadar version) that was marked as a duplicate of #5814810). If you want this officially supported then please also file a radar at bugreport.apple.com.
Update: The above Stumbler code is for 1.x revision iPhone OS SDK. For iPhone OS 2.0 and beyond developers will have to look in PrivateFrameworks/Apple80211.Framework and all that implies.
Try this code,
#import <SystemConfiguration/CaptiveNetwork.h>
CFArrayRef myArray = CNCopySupportedInterfaces();
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
NSDictionary *ssidList = (__bridge NSDictionary*)myDict;
NSString *SSID = [ssidList valueForKey:#"SSID"];